/* Shared Module Styles */
:root {
    --slate: #1a1a2e;
    --slate-light: #2d2d44;
    --amber: #d4a373;
    --amber-light: #e8c9a8;
    --cream: #faf8f5;
    --cream-dark: #f0ebe3;
    --ink: #16213e;
    --muted: #6b7280;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Outfit', system-ui, sans-serif;

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 3rem;
    --space-xl: 4rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--slate);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
nav {
    background: var(--slate);
    color: var(--cream);
    padding: var(--space-sm) var(--space-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav .container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cream);
    text-decoration: none;
}

.logo span { color: var(--amber); }

.nav-module {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.module-selector {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.9rem;
}

.module-selector select {
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: var(--cream);
    cursor: pointer;
    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='%23faf8f5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

.module-selector select option {
    background: var(--slate);
    color: var(--cream);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--amber);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--ink);
}

/* Page Header */
.page-header {
    background: white;
    border-bottom: 1px solid var(--cream-dark);
    padding: var(--space-md);
}

.page-header .container {
    max-width: 1400px;
    margin: 0 auto;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.page-subtitle {
    color: var(--muted);
    font-size: 0.95rem;
}

.header-meta {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    color: var(--muted);
}

/* Main Content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md);
}

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

.kpi-card {
    background: white;
    border-radius: 8px;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--cream-dark);
}

.kpi-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: var(--space-xs);
}

.kpi-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--slate);
    line-height: 1;
}

.kpi-change {
    font-size: 0.85rem;
    margin-top: var(--space-xs);
}

.kpi-change.positive { color: var(--success); }
.kpi-change.negative { color: var(--danger); }
.kpi-change.neutral { color: var(--muted); }

/* Section Cards */
.section-card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--cream-dark);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.section-header {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--cream-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
}

.section-actions {
    display: flex;
    gap: var(--space-xs);
}

.btn-small {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
    background: var(--cream);
    border: 1px solid var(--cream-dark);
    border-radius: 4px;
    cursor: pointer;
    color: var(--slate);
    text-decoration: none;
}

.btn-small:hover {
    background: var(--cream-dark);
}

.section-body {
    padding: var(--space-md);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--cream-dark);
}

th {
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: var(--cream);
}

tr:hover {
    background: rgba(212, 163, 115, 0.05);
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(2, 132, 199, 0.1);
    color: var(--info);
}

.badge-neutral {
    background: var(--cream);
    color: var(--muted);
}

/* Alerts */
.alert {
    padding: var(--space-sm) var(--space-md);
    border-radius: 6px;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.alert-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.alert-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-content p {
    font-size: 0.85rem;
    margin: 0;
}

.alert-warning {
    background: rgba(217, 119, 6, 0.08);
    border-left: 3px solid var(--warning);
}

.alert-warning .alert-icon { color: var(--warning); }

.alert-danger {
    background: rgba(220, 38, 38, 0.08);
    border-left: 3px solid var(--danger);
}

.alert-danger .alert-icon { color: var(--danger); }

.alert-success {
    background: rgba(5, 150, 105, 0.08);
    border-left: 3px solid var(--success);
}

.alert-success .alert-icon { color: var(--success); }

.alert-info {
    background: rgba(2, 132, 199, 0.08);
    border-left: 3px solid var(--info);
}

.alert-info .alert-icon { color: var(--info); }

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

/* Charts Placeholder */
.chart-placeholder {
    height: 250px;
    background: linear-gradient(135deg, var(--cream) 0%, var(--cream-dark) 100%);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Progress Bars */
.progress-bar {
    height: 8px;
    background: var(--cream-dark);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }
.progress-fill.info { background: var(--info); }

/* Footer */
footer {
    padding: var(--space-md);
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--cream-dark);
    margin-top: var(--space-lg);
}

/* Demo Banner */
.demo-banner {
    background: linear-gradient(90deg, var(--amber) 0%, var(--amber-light) 100%);
    color: var(--ink);
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
}

.demo-banner a {
    color: var(--ink);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-module {
        display: none;
    }

    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 0.5rem;
    }

    /* Chart containers on mobile */
    canvas {
        max-height: 250px !important;
    }

    .section-body > div[style*="height"] {
        min-height: 200px;
        max-height: 280px;
    }
}

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

    .kpi-value {
        font-size: 1.5rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .header-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .header-meta span:nth-child(2) {
        display: none;
    }

    main {
        padding: var(--space-sm);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    /* Smaller charts on very small screens */
    canvas {
        max-height: 220px !important;
    }

    /* Table horizontal scroll */
    .section-body:has(table) {
        overflow-x: auto;
    }

    table {
        min-width: 500px;
    }
}
