/*
 * OptionsPlay Design Tokens
 * Source: UI/UX Team Brand Style Guide (op-design-tokens.css)
 * Import this file AFTER Radzen Fluent base theme
 */

:root {
    /* ===================================
       BRAND COLORS
       ================================== */

    /* Brand Green Scale */
    --op-brand-green-900: #1a2e15;
    --op-brand-green-800: #2d4a1e;
    --op-brand-green-700: #3d6129;
    --op-brand-green-600: #4f7a34;      /* PRIMARY */
    --op-brand-green-500: #619640;
    --op-brand-green-400: #7ac143;
    --op-brand-green-300: #94cc66;
    --op-brand-green-200: #aed788;
    --op-brand-green-100: #c8e3aa;
    --op-brand-green-50: #e3f0d4;

    /* Brand Blue Scale */
    --op-brand-blue-900: #001f3f;
    --op-brand-blue-800: #003056;
    --op-brand-blue-700: #00416d;
    --op-brand-blue-600: #005284;
    --op-brand-blue-500: #00639b;
    --op-brand-blue-400: #0074b2;
    --op-brand-blue-300: #3390c1;
    --op-brand-blue-200: #66acd0;
    --op-brand-blue-100: #99c8df;
    --op-brand-blue-50: #cce4ef;

    /* ===================================
       NEUTRAL SCALE (Grayscale)
       ================================== */
    --op-neutral-900: #111827;
    --op-neutral-800: #1f2937;
    --op-neutral-700: #374151;
    --op-neutral-600: #4b5563;
    --op-neutral-500: #6b7280;
    --op-neutral-400: #9ca3af;
    --op-neutral-300: #d1d5db;
    --op-neutral-200: #e5e7eb;
    --op-neutral-100: #f3f4f6;
    --op-neutral-50: #f9fafb;
    --op-neutral-0: #ffffff;

    /* ===================================
       SEMANTIC COLORS
       ================================== */

    /* Success / Bullish */
    --op-success-900: #064e3b;
    --op-success-800: #065f46;
    --op-success-700: #047857;
    --op-success-600: #059669;
    --op-success-500: #10b981;
    --op-success-400: #34d399;
    --op-success-300: #6ee7b7;
    --op-success-200: #a7f3d0;
    --op-success-100: #d1fae5;
    --op-success-50: #ecfdf5;

    /* Error / Bearish */
    --op-error-900: #7f1d1d;
    --op-error-800: #991b1b;
    --op-error-700: #b91c1c;
    --op-error-600: #dc2626;
    --op-error-500: #ef4444;
    --op-error-400: #f87171;
    --op-error-300: #fca5a5;
    --op-error-200: #fecaca;
    --op-error-100: #fee2e2;
    --op-error-50: #fef2f2;

    /* Warning */
    --op-warning-900: #78350f;
    --op-warning-800: #92400e;
    --op-warning-700: #b45309;
    --op-warning-600: #d97706;
    --op-warning-500: #f59e0b;
    --op-warning-400: #fbbf24;
    --op-warning-300: #fcd34d;
    --op-warning-200: #fde68a;
    --op-warning-100: #fef3c7;
    --op-warning-50: #fffbeb;

    /* Info */
    --op-info-900: #312e81;
    --op-info-800: #3730a3;
    --op-info-700: #4338ca;
    --op-info-600: #4f46e5;
    --op-info-500: #6366f1;
    --op-info-400: #818cf8;
    --op-info-300: #a5b4fc;
    --op-info-200: #c7d2fe;
    --op-info-100: #e0e7ff;
    --op-info-50: #eef2ff;

    /* ===================================
       FUNCTIONAL COLORS
       ================================== */

    /* Text */
    --op-text-primary: var(--op-neutral-900);
    --op-text-secondary: var(--op-neutral-500);
    --op-text-tertiary: var(--op-neutral-400);
    --op-text-disabled: var(--op-neutral-300);

    /* Backgrounds */
    --op-bg-primary: var(--op-neutral-0);
    --op-bg-secondary: var(--op-neutral-50);
    --op-bg-tertiary: var(--op-neutral-100);
    --op-bg-search: #f0f9f0;                /* Special mint green */

    /* Borders */
    --op-border-default: var(--op-neutral-200);
    --op-border-subtle: var(--op-neutral-100);
    --op-border-emphasis: var(--op-neutral-300);

    /* Primary Actions */
    --op-primary: var(--op-brand-green-600);
    --op-primary-hover: var(--op-brand-green-700);
    --op-primary-active: var(--op-brand-green-800);
    --op-primary-light: var(--op-brand-green-100);

    /* Option Type Colors (per design spec Section 3.2) */
    --op-call-bg: #dbeafe;
    --op-call-text: #1e40af;
    --op-put-bg: #fed7aa;
    --op-put-text: #9a3412;

    /* ===================================
       PERFORMANCE COLORS
       ================================== */
    --op-perf-excellent: #61BE7E;
    --op-perf-very-good: #AAD283;
    --op-perf-good: #DCE187;
    --op-perf-average: #F5E889;
    --op-perf-below-avg: #FFD785;
    --op-perf-poor: #FDB17C;
    --op-perf-very-poor: #FB6F6C;

    /* ===================================
       TYPOGRAPHY
       ================================== */
    --op-font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --op-font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', Consolas, 'Courier New', monospace;

    /* Font Sizes */
    --op-text-xs: 0.6875rem;       /* 11px */
    --op-text-sm: 0.75rem;         /* 12px */
    --op-text-base: 0.875rem;      /* 14px */
    --op-text-md: 0.9375rem;       /* 15px */
    --op-text-lg: 1rem;            /* 16px */
    --op-text-xl: 1.125rem;        /* 18px */
    --op-text-2xl: 1.25rem;        /* 20px */
    --op-text-3xl: 1.5rem;         /* 24px */
    --op-text-4xl: 1.75rem;        /* 28px */

    /* Font Weights */
    --op-font-regular: 400;
    --op-font-medium: 500;
    --op-font-semibold: 600;
    --op-font-bold: 700;

    /* Line Heights */
    --op-leading-tight: 1.25;
    --op-leading-normal: 1.5;
    --op-leading-relaxed: 1.6;

    /* ===================================
       SPACING
       ================================== */
    --op-space-0: 0;
    --op-space-1: 0.25rem;         /* 4px */
    --op-space-2: 0.5rem;          /* 8px */
    --op-space-3: 0.75rem;         /* 12px */
    --op-space-4: 1rem;            /* 16px */
    --op-space-5: 1.25rem;         /* 20px */
    --op-space-6: 1.5rem;          /* 24px */
    --op-space-7: 1.75rem;         /* 28px */
    --op-space-8: 2rem;            /* 32px */
    --op-space-10: 2.5rem;         /* 40px */
    --op-space-12: 3rem;           /* 48px */

    /* ===================================
       BORDER RADIUS
       ================================== */
    --op-radius-none: 0;
    --op-radius-sm: 0.25rem;       /* 4px */
    --op-radius-md: 0.375rem;      /* 6px */
    --op-radius-lg: 0.5rem;        /* 8px */
    --op-radius-xl: 0.75rem;       /* 12px */
    --op-radius-2xl: 1rem;         /* 16px */
    --op-radius-full: 9999px;

    /* ===================================
       SHADOWS
       ================================== */
    --op-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --op-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --op-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --op-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --op-shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.04);

    /* ===================================
       Z-INDEX SCALE
       ================================== */
    --op-z-base: 0;
    --op-z-dropdown: 100;
    --op-z-sticky: 200;
    --op-z-overlay: 300;
    --op-z-modal: 400;
    --op-z-toast: 500;
    --op-z-tooltip: 600;

    /* ===================================
       LEGACY COMPATIBILITY
       Map old --op-*-color variables to new tokens
       so existing CSS doesn't break immediately
       ================================== */
    --op-primary-color: var(--op-primary);
    --op-secondary-color: var(--op-text-secondary);
    --op-background-color: var(--op-bg-secondary);
    --op-text-color: var(--op-text-primary);
    --op-border-color: var(--op-border-default);
    --op-success-color: var(--op-success-700);
    --op-error-color: var(--op-error-700);
    --op-border-radius: var(--op-radius-sm);

    /* FOMO overlay */
    --op-fomo-backdrop: rgba(255, 255, 255, 0.55);

    /* ===================================
       CHART COLORS (light mode defaults)
       Shared palette for SVG, Canvas, and Highcharts renderers.
       Brand colors (curve, profit, loss, breakeven) are fixed in both themes.
       ================================== */
    --op-chart-bg: transparent;
    --op-chart-panel-bg: var(--op-neutral-50);
    --op-chart-text: var(--op-neutral-900);
    --op-chart-muted: var(--op-neutral-500);
    --op-chart-grid: rgba(0, 0, 0, 0.06);
    --op-chart-line: var(--op-neutral-300);
    --op-chart-zero: var(--op-neutral-400);
    --op-chart-zone-inner: rgba(0, 0, 0, 0.06);
    --op-chart-zone-outer: rgba(0, 0, 0, 0.03);
    --op-chart-sd-line: rgba(0, 0, 0, 0.15);
    --op-chart-prob-label: rgba(0, 0, 0, 0.4);
    --op-chart-annot-bg: #ffffff;
    --op-chart-annot-border: var(--op-neutral-200);
    --op-chart-dot-stroke: #ffffff;
    --op-chart-insight-bg: var(--op-neutral-100);
    --op-chart-insight-text: var(--op-neutral-700);
    --op-chart-insight-bold: var(--op-neutral-900);
    --op-chart-insight-quote: rgba(0, 0, 0, 0.06);
    --op-chart-scrollbar: rgba(0, 0, 0, 0.15);
    --op-chart-range-bar-outer: var(--op-neutral-300);
    --op-chart-range-tick: var(--op-neutral-400);
}

/* ===================================
   DARK MODE OVERRIDES
   Activated by themeInterop.setTheme(true) which sets
   data-theme="dark" on <html> AND swaps Radzen Fluent
   theme to fluent-dark-base.css (provides --rz-* dark values)
   ================================== */
[data-theme="dark"] {
    /* --- Functional Colors (flip light↔dark) --- */

    /* Text: light on dark */
    --op-text-primary: #e5e5e5;
    --op-text-secondary: #a0a0a0;
    --op-text-tertiary: #787878;
    --op-text-disabled: #505050;

    /* Backgrounds: dark surfaces */
    --op-bg-primary: #292929;             /* Widget/card background — matches --rz-base-700 */
    --op-bg-secondary: #1f1f1f;           /* Page/section background — matches --rz-base-800 */
    --op-bg-tertiary: #333333;            /* Elevated surfaces — matches --rz-base-500 */
    --op-bg-search: #1a2e1a;              /* Dark mint green for search */

    /* Borders: subtle on dark */
    --op-border-default: #444444;
    --op-border-subtle: #333333;
    --op-border-emphasis: #5c5c5c;        /* Matches --rz-base-200 in dark */

    /* Primary Actions: slightly brighter green for dark backgrounds */
    --op-primary: #7ac143;                /* Lighter green for better contrast */
    --op-primary-hover: #94cc66;
    --op-primary-active: #619640;
    --op-primary-light: #2d4a1e;          /* Inverted: dark green tint */

    /* Option Type Colors: muted for dark backgrounds */
    --op-call-bg: #1e3a5f;
    --op-call-text: #93bbfc;
    --op-put-bg: #5f3a1e;
    --op-put-text: #fdb17c;

    /* --- Shadows: lighter for dark mode --- */
    --op-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --op-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --op-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --op-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4), 0 4px 6px rgba(0, 0, 0, 0.2);
    --op-shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5), 0 10px 10px rgba(0, 0, 0, 0.2);

    /* --- Legacy compatibility (auto-updates) --- */
    --op-primary-color: var(--op-primary);
    --op-secondary-color: var(--op-text-secondary);
    --op-background-color: var(--op-bg-secondary);
    --op-text-color: var(--op-text-primary);
    --op-border-color: var(--op-border-default);
    --op-success-color: var(--op-success-400);   /* Brighter green for dark bg */
    --op-error-color: var(--op-error-400);        /* Brighter red for dark bg */

    /* FOMO overlay — dark tinted glass */
    --op-fomo-backdrop: rgba(0, 0, 0, 0.55);

    /* --- Status pills: muted tinted backgrounds for dark mode --- */
    --op-pill-draft-bg: rgba(245, 127, 23, 0.15);
    --op-pill-draft-text: #fbbf24;
    --op-pill-draft-border: rgba(245, 127, 23, 0.3);

    --op-pill-published-bg: rgba(46, 125, 50, 0.15);
    --op-pill-published-text: #6ee7b7;
    --op-pill-published-border: rgba(46, 125, 50, 0.3);

    --op-pill-archived-bg: rgba(255, 255, 255, 0.08);
    --op-pill-archived-text: #a0a0a0;
    --op-pill-archived-border: rgba(255, 255, 255, 0.15);

    --op-pill-info-bg: rgba(21, 101, 192, 0.15);
    --op-pill-info-text: #93bbfc;
    --op-pill-info-border: rgba(21, 101, 192, 0.3);

    --op-pill-global-bg: rgba(106, 27, 154, 0.15);
    --op-pill-global-text: #ce93d8;
    --op-pill-global-border: rgba(106, 27, 154, 0.3);

    --op-pill-forked-bg: rgba(230, 81, 0, 0.15);
    --op-pill-forked-text: #ffcc80;
    --op-pill-forked-border: rgba(230, 81, 0, 0.3);

    /* --- Chart Colors (dark overrides) --- */
    --op-chart-bg: transparent;
    --op-chart-panel-bg: #0f1923;
    --op-chart-text: #e0e8ef;
    --op-chart-muted: #8ca0b3;
    --op-chart-grid: rgba(255, 255, 255, 0.04);
    --op-chart-line: #2a3a4a;
    --op-chart-zero: #5a7080;
    --op-chart-zone-inner: rgba(255, 255, 255, 0.10);
    --op-chart-zone-outer: rgba(255, 255, 255, 0.04);
    --op-chart-sd-line: rgba(255, 255, 255, 0.2);
    --op-chart-prob-label: rgba(255, 255, 255, 0.45);
    --op-chart-annot-bg: #1a2733;
    --op-chart-annot-border: #2a3a4a;
    --op-chart-dot-stroke: #0f1923;
    --op-chart-insight-bg: #0f1923;
    --op-chart-insight-text: rgba(255, 255, 255, 0.75);
    --op-chart-insight-bold: rgba(255, 255, 255, 0.95);
    --op-chart-insight-quote: rgba(255, 255, 255, 0.06);
    --op-chart-scrollbar: rgba(255, 255, 255, 0.15);
    --op-chart-range-bar-outer: #3a4a5a;
    --op-chart-range-tick: #6b7f8e;
}