/* ==========================================================================
   TTB COLA Registry — Base CSS
   Loaded FIRST on every page. Provides variables, reset, layout, sidebar,
   and common components. Page-specific CSS loads SECOND and wins by cascade.
   ========================================================================== */

/* ---------- Design Tokens (canonical) ---------- */
:root {
    /* Professional Color Palette */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #eff6ff;
    --secondary-color: #374151;
    --secondary-light: #f3f4f6;

    /* Neutral Colors */
    --white: #ffffff;
    --black: #000000;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Status Colors */
    --success-color: #10b981;
    --success-light: #ecfdf5;
    --warning-color: #f59e0b;
    --warning-light: #fffbeb;
    --error-color: #ef4444;
    --error-light: #fef2f2;
    --info-color: #3b82f6;
    --info-light: #eff6ff;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Borders & Radius */
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* ---- Aliases for audit.css ---- */
    --primary-blue: #2563eb;
    --secondary-blue: #1e40af;
    --success-green: #059669;
    --warning-yellow: #d97706;
    --danger-red: #dc2626;
    --border-radius: 0.5rem;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* ---- Aliases for producers.css ---- */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --primary-blue-hover: #1d4ed8;
    --primary-blue-light: #dbeafe;

    /* ---- Aliases for consolidation / enrichment / learning ---- */
    --surface-color: #ffffff;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --text-color: #111827;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --accent-color: #2563eb;
    --primary-hover: #1e40af;
    --surface-secondary: #f9fafb;
    --hover-color: #f3f4f6;
    --border-light: #f3f4f6;

    /* ---- Sidebar ---- */
    --sidebar-width: 240px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-active-bg: rgba(37, 99, 235, 0.15);
    --sidebar-active-text: #60a5fa;
    --sidebar-border: #1e293b;
}

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

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: var(--font-primary);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    color: var(--gray-900);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- App Layout ---------- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content-area {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
}

/* ---------- Container ---------- */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0;
}

/* ---------- Sidebar Navigation ---------- */
.sidebar-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar-logo {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo h1 {
    font-size: 1rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.025em;
    line-height: 1.3;
}

.sidebar-logo .sidebar-subtitle {
    font-size: 0.6875rem;
    color: var(--sidebar-text);
    font-weight: 400;
    margin-top: 2px;
}

.sidebar-section {
    padding: 0.75rem 0 0;
}

.sidebar-section-label {
    padding: 0 1.25rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
}

.sidebar-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0;
    transition: color 0.15s, background 0.15s;
}

.sidebar-link:hover {
    color: var(--sidebar-text-hover);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
    font-weight: 600;
}

.sidebar-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg {
    opacity: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--sidebar-border);
    font-size: 0.6875rem;
    color: #475569;
}

/* Hamburger (mobile) */
.sidebar-hamburger {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 250;
    background: var(--sidebar-bg);
    color: #e2e8f0;
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius-md);
    padding: 0.5rem;
    cursor: pointer;
    line-height: 1;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 190;
}

/* ---------- Responsive Sidebar ---------- */
@media (max-width: 768px) {
    .sidebar-nav {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar-nav.open {
        transform: translateX(0);
    }

    .sidebar-hamburger {
        display: block;
    }

    .sidebar-close {
        display: block;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content-area {
        margin-left: 0;
    }
}

/* ---------- Utility Classes ---------- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.bg-white { background: var(--white); }
.bg-gray-50 { background: var(--gray-50); }
.bg-primary { background: var(--primary-color); }
.border { border: 1px solid var(--gray-200); }
.border-t { border-top: 1px solid var(--gray-200); }
.border-b { border-bottom: 1px solid var(--gray-200); }
.rounded { border-radius: var(--border-radius-md); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.p-4 { padding: var(--spacing-md); }
.p-6 { padding: var(--spacing-lg); }
.m-4 { margin: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-md); }
