/**
 * V2T FlexPlan AI - CSS Variables
 * Light Glass Theme - Precision Industrial x Future Tech
 */

:root {
    /* Primary Colors - Teal */
    --color-primary: #00D4AA;
    --color-primary-dark: #00A888;
    --color-primary-darker: #007A63;
    --color-primary-light: #33DDB9;

    /* AI Colors - Electric Violet */
    --color-ai: #A855F7;
    --color-ai-dark: #9333EA;
    --color-ai-light: #C084FC;

    /* Semantic Colors */
    --color-success: #00D68F;
    --color-warning: #FFB020;
    --color-danger: #FF4757;
    --color-critical: #FF4757;
    --color-info: #4DA6FF;

    /* Neutral Colors */
    --color-charcoal: #0D1517;
    --color-gray-900: #1A2224;
    --color-gray-800: #2D3436;
    --color-gray-700: #4A5568;
    --color-gray-600: #718096;
    --color-gray-500: #A0AEC0;
    --color-gray-400: #CBD5E0;
    --color-gray-300: #E2E8F0;
    --color-gray-200: #EDF2F7;
    --color-gray-100: #F7FAFC;
    --color-white: #FFFFFF;
    --color-off-white: #F8FAFA;

    /* Category Colors */
    --color-knits: #3B82F6;
    --color-wovens: #10B981;
    --color-denim: #6366F1;
    --color-outerwear: #F59E0B;
    --color-activewear: #EC4899;

    /* Run Status Colors (replaced zone colors) */
    --color-status-draft: #94A3B8;
    --color-status-planned: #3B82F6;
    --color-status-confirmed: #00D4AA;
    --color-status-in-progress: #F59E0B;
    --color-status-completed: #10B981;
    --color-status-cancelled: #EF4444;

    /* Typography */
    --font-display: 'DM Serif Display', serif;
    --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Spacing */
    --space-0: 0;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
    --shadow-glow-primary: 0 0 20px rgba(0, 212, 170, 0.3);
    --shadow-glow-ai: 0 0 20px rgba(168, 85, 247, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;

    /* Z-Index */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-toast: 9999;

    /* Layout */
    --nav-height: 64px;
    --sidebar-width: 280px;
    --content-max-width: 1440px;

    /* Ribbon Layout (dense 2-row: 34px strip + 30px panel = 64px total) */
    --ribbon-current-height: 64px;

    /* Contextual Tab Accents */
    --color-contextual-selection: rgba(168, 85, 247, 0.12);
    --color-contextual-working: rgba(77, 166, 255, 0.12);

    /* Alias Variables for Factories Page */
    /* Surface & Background */
    --color-surface: var(--color-white);
    --color-bg: var(--color-off-white);
    --color-border: var(--color-gray-200);
    --color-border-hover: var(--color-gray-300);

    /* Text Colors */
    --color-text: var(--color-charcoal);
    --color-text-secondary: var(--color-gray-600);
    --color-text-muted: var(--color-gray-500);

    /* Spacing Aliases */
    --spacing-xs: var(--space-1);
    --spacing-sm: var(--space-2);
    --spacing-md: var(--space-4);
    --spacing-lg: var(--space-6);
    --spacing-xl: var(--space-8);

    /* Font Size Aliases */
    --font-size-xs: var(--text-xs);
    --font-size-sm: var(--text-sm);
    --font-size-md: var(--text-base);
    --font-size-lg: var(--text-lg);
    --font-size-xl: var(--text-xl);

    /* Semantic Color Variants */
    --color-success-light: rgba(0, 214, 143, 0.15);
    --color-warning-light: rgba(255, 176, 32, 0.15);
    --color-danger-light: rgba(255, 71, 87, 0.15);
    --color-info-light: rgba(77, 166, 255, 0.15);

    /* Production Run Block */
    --run-block-height: 48px;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-darker) 100%);
    --gradient-ai: linear-gradient(135deg, var(--color-ai-light) 0%, var(--color-ai-dark) 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);

    /* v69 — inheritance affordances. Dotted=inherited, solid=override.
       The override-tint background is a low-opacity teal so override
       inputs read as "live" without screaming. */
    --color-inherited-border: var(--color-border);
    --color-override-border: var(--color-primary);
    --color-override-tint: rgba(0, 212, 170, 0.06);

    /* Tabular monospace stack for time / datetime / capacity cells.
       System-only, no webfont download. */
    --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

    /* ─── velvet-napping-zebra v93: Plan Lens palettes ──────────────────
       Token-only colour sets that drive Plan Lens bar fills / outlines.
       Per the standing modal-theme rule (feedback_modal_theme), every
       Lens colour lookup goes through these tokens -- no hex literals
       in plan_lens.js or GanttChart.jsx. Dark theme overrides at the
       bottom of this file shadow the light-theme values one-for-one.

       Palette kinds match field_registry.FIELD_REGISTRY.palette_kind:
         categorical_* / lc_curve - generated per bucket from its sequential
                          slot by the golden-angle generator in plan_lens.js
                          (unbounded distinct hues, no fixed token table)
         sequential_*   - ordered gradient (light -> dark)
         binary_*       - two-tone (matching / not-matching)
         status_default - the existing run-status colour set, aliased
       Lens code looks up `var(--lens-{palette}-{index})` for the semantic
       palettes below; categorical/lc_curve return a computed #RRGGBB. */

    /* Categorical palettes (Customer / Style / Category / Plant / Line and the
       Splits icon tint) are no longer fixed colour tables. Lens code now
       synthesises a unique colour per bucket from its sequential slot via the
       golden-angle generator in static/js/services/plan_lens.js (mirrored in
       services/plan_lens/lens_colors.py for the xlsx export), so colours
       spread evenly and never repeat regardless of bucket count. The
       categorical_6/8/12 palette names are kept for config compatibility but
       the number is now cosmetic. */

    /* Sequential month palette -- 12 hues cycling Jan->Dec.
       Reads as "warm in summer, cool in winter" but the planner
       only needs adjacency-distinct, not seasonal-correct. */
    --lens-sequential_month-0:  #3B82F6;  /* Jan */
    --lens-sequential_month-1:  #6366F1;  /* Feb */
    --lens-sequential_month-2:  #8B5CF6;  /* Mar */
    --lens-sequential_month-3:  #A855F7;  /* Apr */
    --lens-sequential_month-4:  #EC4899;  /* May */
    --lens-sequential_month-5:  #F43F5E;  /* Jun */
    --lens-sequential_month-6:  #F97316;  /* Jul */
    --lens-sequential_month-7:  #F59E0B;  /* Aug */
    --lens-sequential_month-8:  #EAB308;  /* Sep */
    --lens-sequential_month-9:  #84CC16;  /* Oct */
    --lens-sequential_month-10: #10B981;  /* Nov */
    --lens-sequential_month-11: #06B6D4;  /* Dec */

    /* Risk traffic light (green / amber / red). */
    --lens-sequential_risk-green:  #10B981;
    --lens-sequential_risk-amber:  #F59E0B;
    --lens-sequential_risk-red:    #EF4444;

    /* Order priority (LOW -> CRITICAL, cool -> warm). */
    --lens-sequential_priority-low:      #06B6D4;
    --lens-sequential_priority-normal:   #10B981;
    --lens-sequential_priority-high:     #F59E0B;
    --lens-sequential_priority-critical: #EF4444;

    /* Binary lenses (positive / negative).
       The "off" tone is purposely neutral so a binary lens stacked
       on top of a FILL lens doesn't paint everything the same. */
    --lens-binary_late-on:        #EF4444;
    --lens-binary_late-off:       transparent;
    --lens-binary_material-on:    #F59E0B;
    --lens-binary_material-off:   transparent;
    /* Compliance is a two-tone FILL palette (not an outline), so the "off"
       tone is a real colour, not transparent: green = fabric in by start,
       red = run starts before its material in-date. */
    --lens-binary_compliance-on:  #EF4444;
    --lens-binary_compliance-off: #16A34A;

    /* Status palette -- aliases the existing run-status tokens above
       so the default Status FILL lens looks identical to v3.2.4.x. */
    --lens-status_default-DRAFT:       var(--color-status-draft);
    --lens-status_default-PLANNED:     var(--color-status-planned);
    --lens-status_default-CONFIRMED:   var(--color-status-confirmed);
    --lens-status_default-IN_PROGRESS: var(--color-status-in-progress);
    --lens-status_default-COMPLETED:   var(--color-status-completed);
    --lens-status_default-CANCELLED:   var(--color-status-cancelled);
    --lens-status_default-ABORTED:     var(--color-status-cancelled);
    --lens-status_default-ON_HOLD:     var(--color-gray-500);
    --lens-status_default-SUSPENDED:   var(--color-gray-500);

    /* SPEC-123 Learning-Curve OUTLINE lens: one tone per curve, also generated
       by the golden-angle generator (deeper jewel saturation/lightness bands)
       so curve outlines stay mutually distinct beyond any fixed palette size. */

    /* Fallback for unknown buckets (palette miss). Keeps bars visible
       rather than rendering an empty/transparent block. */
    --lens-fallback: var(--color-gray-400);
}

/* ============================================
   Dark Theme Overrides
   Applied via body[data-theme="dark"] (runtime)
   and html[data-theme-loading="dark"] (pre-render FOUC prevention)
   ============================================ */
body[data-theme="dark"],
html[data-theme-loading="dark"] {
    /* Neutral Colors - inverted for dark backgrounds */
    --color-charcoal: #e8ecf1;
    --color-gray-900: #f1f5f9;
    --color-gray-800: #e2e8f0;
    --color-gray-700: #cbd5e1;
    --color-gray-600: #94a3b8;
    --color-gray-500: #64748b;
    --color-gray-400: #475569;
    --color-gray-300: #334155;
    --color-gray-200: #253042;
    --color-gray-100: #1e2535;
    --color-white: #1a1f2e;
    --color-off-white: #0f1219;
    --color-gray-50: #161b27;

    /* Surface & Background */
    --color-surface: #1a1f2e;
    --color-bg: #0f1219;
    --color-border: #253042;
    --color-border-hover: #334155;

    /* Text Colors */
    --color-text: #e8ecf1;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;

    /* Shadows - deeper for dark backgrounds */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.35), 0 4px 6px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.4), 0 10px 10px rgba(0, 0, 0, 0.2);

    /* Gradients */
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);

    /* Semantic Color Variants - slightly brighter on dark */
    --color-success-light: rgba(0, 214, 143, 0.2);
    --color-warning-light: rgba(255, 176, 32, 0.2);
    --color-danger-light: rgba(255, 71, 87, 0.2);
    --color-info-light: rgba(77, 166, 255, 0.2);

    /* Contextual Tab Accents - dark mode */
    --color-contextual-selection: rgba(168, 85, 247, 0.2);
    --color-contextual-working: rgba(77, 166, 255, 0.2);

    /* v69 — inheritance tint, slightly brighter on dark for legibility. */
    --color-override-tint: rgba(0, 212, 170, 0.12);
}
