/* Email Panel System - Theme System (Light/Dark Mode) */

/* ⚠️ DEPRECATION NOTICE ⚠️
 * Variables with -legacy suffix are deprecated and will be removed after all pages migrate
 * New pages MUST use modern variables (without -legacy suffix)
 * Migration tracked in: /docs/css-theme-modernization/migration-status.md
 */

/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===========================
   LIGHT MODE (DEFAULT)
   =========================== */

:root {
    /* ===================================
       MODERN THEME SYSTEM (NEW)
       =================================== */

    /* Spacing System - 4px grid */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;
    --space-16: 64px;

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

    /* Typography Scale */
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 30px;
    --text-4xl: 36px;

    /* Component-Specific Typography */
    --font-size-table: 14px;

    /* Component-Specific Colors */
    --progress-bar-text: var(--text-primary);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Modern Backgrounds (Light Mode) */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-input: #ffffff;
    --bg-input-hover: #f8fafc;

    /* Modern Text Colors (Light Mode) */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;

    /* Modern Borders (Light Mode) */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-focus: #3b82f6;
    --border-cyan: #06b6d4;

    /* Modern Shadows (Light Mode) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --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.12), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Glass Effects (Light Mode) */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.3);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    --gradient-warning: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    --gradient-warning-solid: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-purple: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);

    /* Overlay & Accent Colors (for use on colored backgrounds) */
    --overlay-white-subtle: rgba(255, 255, 255, 0.1);
    --overlay-white-light: rgba(255, 255, 255, 0.2);
    --overlay-white-medium: rgba(255, 255, 255, 0.3);
    --text-on-colored-bg: #ffffff;
    --stroke-on-colored-bg: #ffffff;

    /* Semantic Color Overlays (10% opacity backgrounds) */
    --overlay-primary: rgba(59, 130, 246, 0.1);
    --overlay-success: rgba(34, 197, 94, 0.1);
    --overlay-warning: rgba(245, 158, 11, 0.1);
    --overlay-error: rgba(239, 68, 68, 0.1);

    /* Special Effect Shadows */
    --shadow-cyan-glow: 0 20px 40px -10px rgba(6, 182, 212, 0.4);
    --shadow-cyan-glow-intense: 0 20px 40px -10px rgba(6, 182, 212, 0.6);

    /* ===================================
       LEGACY VARIABLES (TO BE REMOVED)
       =================================== */

    /* Backward Compatibility Aliases - Map old names to new modern variables */
    --bg-primary: var(--bg-card);

    /* Primary Colors */
    --color-primary-50: #eff6ff;
    --color-primary-100: #dbeafe;
    --color-primary-200: #bfdbfe;
    --color-primary-300: #93c5fd;
    --color-primary-400: #60a5fa;
    --color-primary-500: #3b82f6;
    --color-primary-600: #2563eb;
    --color-primary-700: #1d4ed8;
    --color-primary-800: #1e40af;
    --color-primary-900: #1e3a8a;

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

    /* Semantic Colors */
    --color-success-50: #f0fdf4;
    --color-success-500: #22c55e;
    --color-success-600: #16a34a;
    --color-success-700: #15803d;

    --color-warning-50: #fffbeb;
    --color-warning-100: #fef3c7;
    --color-warning-200: #fde68a;
    --color-warning-300: #fcd34d;
    --color-warning-500: #f59e0b;
    --color-warning-600: #d97706;
    --color-warning-700: #b45309;
    --color-warning-800: #92400e;
    --color-warning-900: #78350f;

    --color-error-50: #fef2f2;
    --color-error-500: #ef4444;
    --color-error-600: #dc2626;
    --color-error-700: #b91c1c;

    --color-info-50: #ecfeff;
    --color-info-500: #06b6d4;
    --color-info-600: #0891b2;
    --color-info-700: #0e7490;

    /* Extended Success Colors */
    --color-success-100: #d1fae5;
    --color-success-200: #a7f3d0;
    --color-success-800: #065f46;
    --color-success-900: #064e3b;

    /* Extended Error Colors */
    --color-error-100: #fee2e2;
    --color-error-200: #fecaca;
    --color-error-800: #991b1b;
    --color-error-900: #7f1d1d;

    /* Orange Colors */
    --color-orange-50: #fff7ed;
    --color-orange-100: #ffedd5;
    --color-orange-200: #fed7aa;
    --color-orange-400: #fb923c;
    --color-orange-500: #f97316;
    --color-orange-600: #ea580c;
    --color-orange-700: #c2410c;
    --color-orange-800: #9a3412;
    --color-orange-900: #7c2d12;

    /* Purple Colors */
    --color-purple-400: #a78bfa;
    --color-purple-500: #8b5cf6;
    --color-purple-600: #7c3aed;
    --color-purple-700: #6d28d9;

    /* Blue Colors (Material Design) */
    --color-blue-600: #2563eb;
    --color-blue-700: #1d4ed8;
    --color-blue-800: #1e40af;

    /* Gradients */
    --gradient-purple: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    --gradient-orange: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);

    /* Modal/Overlay Backgrounds */
    --modal-overlay-bg: rgba(0, 0, 0, 0.5);
    --modal-overlay-dark: rgba(0, 0, 0, 0.7);
    --bg-overlay-light: rgba(255, 255, 255, 0.1);
    --border-overlay-light: rgba(255, 255, 255, 0.2);
    --bg-overlay-lighter: rgba(255, 255, 255, 0.2);

    /* Additional Semantic Colors */
    --text-heading: #2c3e50;

    /* Theme-specific variables (LIGHT MODE) - LEGACY */
    --bg-primary-legacy: #ffffff;
    --bg-secondary-legacy: #f9fafb;
    --bg-tertiary-legacy: #f3f4f6;
    --bg-header: #2c3e50;
    --bg-nav: #333333;
    --bg-client-switcher: #f8f9fa;

    --text-primary-legacy: #111827;
    --text-secondary-legacy: #4b5563;
    --text-tertiary-legacy: #6b7280;
    --text-inverse-legacy: #ffffff;
    --text-header: #ffffff;
    --text-nav: #ffffff;

    --border-primary: #e5e7eb;
    --border-secondary: #d1d5db;
    --border-focus-legacy: #3b82f6;

    --shadow-sm-legacy: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md-legacy: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg-legacy: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl-legacy: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --alert-success-bg: #d4edda;
    --alert-success-text: #155724;
    --alert-success-border: #c3e6cb;

    --alert-error-bg: #f8d7da;
    --alert-error-text: #721c24;
    --alert-error-border: #f5c6cb;

    --alert-info-bg: #d1ecf1;
    --alert-info-text: #0c5460;
    --alert-info-border: #bee5eb;

    /* Font */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

/* ===========================
   DARK MODE
   =========================== */

[data-theme="dark"] {
    /* Keep primary colors (they work well in dark mode) */
    /* Extended color scales inherit from light mode and work well in dark mode */

    /* ===================================
       MODERN THEME SYSTEM (DARK MODE)
       =================================== */

    /* Modern Backgrounds (Dark Mode) */
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-secondary: #334155;
    --bg-tertiary: #475569;
    --bg-input: #1e293b;
    --bg-input-hover: #334155;

    /* Modern Text Colors (Dark Mode) */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-inverse: #0f172a;

    /* Modern Borders (Dark Mode) */
    --border-color: #334155;
    --border-hover: #475569;
    --border-focus: #3b82f6;

    /* Modern Shadows (Dark Mode) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);

    /* Glass Effects (Dark Mode) */
    --glass-bg: rgba(30, 41, 59, 0.95);
    --glass-border: rgba(51, 65, 85, 0.3);

    /* Component-Specific Typography (Dark Mode) */
    --font-size-table: 14px;

    /* Component-Specific Colors (Dark Mode) */
    --progress-bar-text: var(--text-primary);

    /* ===================================
       LEGACY VARIABLES (DARK MODE)
       =================================== */

    /* Backward Compatibility Aliases - Map old names to new modern variables */
    --bg-primary: var(--bg-card);

    /* Dark mode heading color override */
    --text-heading: #f1f5f9;

    /* Dark mode modal overlays (slightly more opaque) */
    --modal-overlay-bg: rgba(0, 0, 0, 0.7);
    --modal-overlay-dark: rgba(0, 0, 0, 0.85);
    --bg-overlay-light: rgba(0, 0, 0, 0.2);
    --border-overlay-light: rgba(0, 0, 0, 0.3);
    --bg-overlay-lighter: rgba(0, 0, 0, 0.3);

    /* Theme-specific variables (DARK MODE) - LEGACY */
    --bg-primary-legacy: #0f172a;
    --bg-secondary-legacy: #1e293b;
    --bg-tertiary-legacy: #334155;
    --bg-header: #1e293b;
    --bg-nav: #0f172a;
    --bg-client-switcher: #1e293b;

    --text-primary-legacy: #f1f5f9;
    --text-secondary-legacy: #cbd5e1;
    --text-tertiary-legacy: #94a3b8;
    --text-inverse-legacy: #0f172a;
    --text-header: #f1f5f9;
    --text-nav: #cbd5e1;

    --border-primary: #334155;
    --border-secondary: #475569;
    --border-focus-legacy: #60a5fa;

    --shadow-sm-legacy: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md-legacy: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
    --shadow-lg-legacy: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --shadow-xl-legacy: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);

    --alert-success-bg: #064e3b;
    --alert-success-text: #d1fae5;
    --alert-success-border: #047857;

    --alert-error-bg: #7f1d1d;
    --alert-error-text: #fecaca;
    --alert-error-border: #991b1b;

    --alert-info-bg: #164e63;
    --alert-info-text: #cffafe;
    --alert-info-border: #0891b2;
}
