/* ========================================
   Sellityet - Common Design System
   Shared across all views
   ======================================== */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables – Light Gold (Default, overridden by theme.css) */
:root {
    --primary: #C9941A;
    --primary-dark: #A67C14;
    --primary-light: #FFF3CC;
    --accent: #E6B422;
    --accent-dark: #C9941A;

    --bg: #FFFBF2;
    --surface: #FFFFFF;
    --surface-alt: #FFF8E7;

    --text-primary: #3D3428;
    --text-secondary: #6B5E4F;
    --text-muted: #9A8B78;
    --text-inverse: #FFFFFF;

    --border: #E8DFC8;
    --border-light: #F3EBD6;

    --success: #2E7D32;
    --success-bg: #E8F5E9;
    --warning: #E6A817;
    --warning-bg: #FFF8E1;
    --danger: #C62828;
    --danger-bg: #FFEBEE;
    --info: #C9941A;
    --info-bg: #FFF8E7;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Typography */
    --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-md: 16px;
    --font-size-lg: 20px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;
    --font-size-3xl: 40px;

    /* Borders & Shadows */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 50%;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Layout */
    --max-width: 1200px;
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 72px;
    --header-height: 64px;
}

/* Base */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* Typography */
h1 { font-size: var(--font-size-2xl); font-weight: 700; line-height: 1.2; }
h2 { font-size: var(--font-size-xl); font-weight: 600; line-height: 1.3; }
h3 { font-size: var(--font-size-lg); font-weight: 600; line-height: 1.4; }
h4 { font-size: var(--font-size-md); font-weight: 600; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
}
.btn-primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface-alt);
    text-decoration: none;
}

.btn-accent {
    background: var(--accent);
    color: var(--text-inverse);
}
.btn-accent:hover {
    background: var(--accent-dark);
    text-decoration: none;
}

.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
}
.btn-danger:hover {
    background: #b52c30;
    text-decoration: none;
}

.btn-sm { padding: 6px 12px; font-size: var(--font-size-sm); }
.btn-lg { padding: 14px 28px; font-size: var(--font-size-md); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--surface);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23605E5C' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.card-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: var(--space-lg);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: #8A6914; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--surface-alt); color: var(--text-secondary); }

.product-stock {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--success-bg);
    color: var(--success);
    margin-top: 2px;
}

.product-stock.is-low {
    background: var(--warning-bg);
    color: #8A6914;
}

.product-stock.is-out {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 12px var(--space-md);
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px var(--space-md);
    border-bottom: 1px solid var(--border-light);
    font-size: var(--font-size-sm);
}

tr:hover td {
    background: var(--surface-alt);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--border-light);
}

.stat-card .stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.stat-card .stat-value {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) var(--space-xl);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: var(--font-size-md);
}

.brand:hover { text-decoration: none; }

.brand-logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { margin: 0; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    color: white;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: toastIn 0.3s ease;
    min-width: 280px;
    max-width: 420px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: #D48A00; }
.toast-info { background: var(--primary); }

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-md);
    opacity: 0.4;
}

/* Alert */
.alert {
    padding: var(--space-md);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-sm);
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: #8A6914; border: 1px solid var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info); }

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: var(--font-size-sm); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
    :root {
        --space-xl: 16px;
        --font-size-2xl: 24px;
        --font-size-xl: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    table {
        font-size: var(--font-size-xs);
    }

    th, td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- Inquiry cards (Dashboard + Shop) ---- */
.inquiries-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.inquiry-card {
    display: flex;
    align-items: center;
    gap: 16px 24px;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: none;
}

.inquiry-card.is-unread {
    border-color: transparent;
    background: transparent;
}

.inquiry-col-customer,
.inquiry-col-product {
    flex: 1 1 30%;
    min-width: 140px;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.inquiry-col-product {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inquiry-col-text {
    min-width: 0;
    flex: 1;
}

.inquiry-field-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.inquiry-product-thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
}

.inquiry-product-thumb.is-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
}

.inquiry-col-customer strong,
.inquiry-col-product strong {
    display: block;
    font-size: var(--font-size-md);
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.inquiry-col-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    flex: 0 0 auto;
    margin-left: auto;
}

.inquiry-delete-btn {
    min-width: auto !important;
}

.inquiry-col-actions .btn {
    min-width: 88px;
    border-radius: 100px;
    font-weight: 600;
    font-size: var(--font-size-xs);
    padding: 8px 14px;
}

.inquiry-state {
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 100px;
    white-space: nowrap;
}

.inquiry-state.is-accepted {
    background: var(--success-bg);
    color: var(--success);
}

.inquiry-state.is-rejected {
    background: var(--danger-bg);
    color: var(--danger);
}

@media (max-width: 640px) {
    .inquiry-card {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
    }

    .inquiry-col-product,
    .inquiry-col-customer {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }

    .inquiry-col-product strong,
    .inquiry-col-customer strong {
        white-space: normal;
    }

    .inquiry-col-actions {
        flex: 1 1 100%;
        width: 100%;
        margin-left: 0;
    }

    .inquiry-col-actions .btn {
        flex: 1;
        min-width: 0;
    }

    .inquiry-state {
        flex: 1;
        text-align: center;
    }
}

/* Owner-Bubble (Anfragen + Plan im Dropdown) */
.owner-bubble {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    overflow: visible;
    z-index: 50001;
    isolation: isolate;
}

.owner-bubble-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #E8DFC8);
    color: var(--text-secondary, #6B5E4F);
    cursor: pointer;
    padding: 0;
    font: inherit;
    overflow: visible;
    transition: border-color 0.2s, color 0.2s;
}

.owner-bubble-trigger:hover {
    border-color: var(--primary, #C9941A);
    color: var(--primary, #C9941A);
}

.owner-bubble-trigger svg {
    width: 17px;
    height: 17px;
}

.owner-bubble-count {
    display: none;
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 100px;
    background: #DC2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    z-index: 2;
    box-shadow: 0 0 0 2px #ffffff, 0 2px 8px rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

.owner-bubble-count.is-visible {
    display: block;
}

.owner-bubble-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #E8DFC8);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
    z-index: 50002;
    overflow: hidden;
}

.owner-bubble-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    color: var(--text-primary, #3D3428);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
    cursor: pointer;
}

.owner-bubble-item:hover {
    background: var(--surface-alt, #FFF8E7);
}

button.owner-bubble-item {
    width: 100%;
    border: none;
    background: none;
    font: inherit;
    text-align: left;
}

.owner-bubble-inquiry-meta {
    font-size: 12px;
    font-weight: 600;
    color: #DC2626;
}

.owner-bubble-divider {
    height: 1px;
    background: var(--border, #E8DFC8);
}

.owner-bubble-group-label {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #9A8B78);
}

.owner-bubble-plan-name {
    font-size: 14px;
    font-weight: 700;
}

.owner-bubble-plan.plan-basic .owner-bubble-plan-name { color: #15803d; }
.owner-bubble-plan.plan-professional .owner-bubble-plan-name { color: #1e3a8a; }
.owner-bubble-plan.plan-ultimate .owner-bubble-plan-name { color: #6d28d9; }

body.app-hyperspeed .owner-bubble-trigger {
    background: var(--hs-blue-bg, rgba(15, 35, 85, 0.72));
    border-color: var(--hs-border, rgba(96, 165, 250, 0.35));
    color: var(--hs-text, #e2e8f0);
}

body.app-hyperspeed .owner-bubble-menu {
    background: rgba(15, 35, 85, 0.96);
    border-color: rgba(96, 165, 250, 0.35);
    color: var(--hs-text, #e2e8f0);
}

body.app-hyperspeed .owner-bubble-item {
    color: var(--hs-text, #e2e8f0);
}

body.app-hyperspeed .owner-bubble-item:hover {
    background: rgba(96, 165, 250, 0.12);
}

body.app-hyperspeed .owner-bubble-divider {
    background: rgba(96, 165, 250, 0.25);
}

body.app-hyperspeed .owner-bubble-plan.plan-basic .owner-bubble-plan-name { color: #81c784; }
body.app-hyperspeed .owner-bubble-plan.plan-professional .owner-bubble-plan-name { color: #93c5fd; }
body.app-hyperspeed .owner-bubble-plan.plan-ultimate .owner-bubble-plan-name { color: #c4b5fd; }
