/* ============================================================================
   AERIUM - Main Stylesheet
   No global element styles - Everything is class-based
   ============================================================================ */

/* ============================================================================
   CSS VARIABLES - The only "global" part
   ============================================================================ */
:root {
    /* Colors - Light Modern Theme (Default) */
    --color-bg: #ffffff;
    --color-surface: #f8fafc;
    --color-surface-hover: #f1f5f9;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    --color-text-primary: var(--color-text);
    --color-background: var(--color-surface);
    --color-primary-dark: var(--color-primary-hover);

    /* Input and Card Backgrounds */
    --color-card-bg: #ffffff;
    --color-input-bg: #ffffff;
    --color-input-text: #1e293b;

    /* Tinted Backgrounds for Icons */
    --color-primary-bg: #eff6ff;
    --color-success-bg: #f0fdf4;
    --color-warning-bg: #fffbeb;
    --color-info-bg: #f0fdfa;

    /* Client Header */
    --client-header-gradient: linear-gradient(135deg, #2c5282 0%, #2d3748 100%);
    --client-header-text: #ffffff;

    /* Brand Colors - Professional Blues */
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #06b6d4;

    /* Secondary button colors */
    --color-secondary: #6b7280;
    --color-secondary-hover: #4b5563;
    --color-secondary-bg: #f3f4f6;

    /* Leave button colors */
    --color-leave: #2196F3;
    --color-leave-hover: #1976D2;
    --color-leave-gradient-start: #42A5F5;
    --color-leave-gradient-end: #1E88E5;

    /* Borders */
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;

    /* Solid colors instead of gradients for professional look */
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #3b82f6 100%);
    --gradient-success: linear-gradient(135deg, #22c55e 0%, #22c55e 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #f59e0b 100%);
    --gradient-info: linear-gradient(135deg, #06b6d4 0%, #06b6d4 100%);

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

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 0.9rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;

    /* Component-Specific Font Sizes */
    --font-size-data-grid-header: var(--font-size-xs);
    /* 12px */
    --font-size-data-grid-cell: 0.8125rem;
    /* 13px */
    --font-size-data-grid-badge: 0.625rem;
    /* 10px */

    /* Layout */
    --app-min-width: 1100px;
    --sidebar-width: 180px;
    --header-height: 60px;
    --sidebar-header-height: 73px; /* Sidebar header height (logo section) */
    --sidebar-collapsed-width: 88px;
    --sidebar-nav-item-height: 60px;

    /* Overscroll Behavior - Customizable per theme */
    --overscroll-behavior-x: contain;

    /* Shadows - Semantic naming for cleaner code */
    --shadow-subtle: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-default: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-elevated: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-overlay: 0 20px 50px -10px rgb(0 0 0 / 0.15), 0 10px 20px -5px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-full: 9999px;

    /* ============================================================================
       Z-INDEX SCALE - Documented layering system
       ============================================================================ */
    /* Base layers (1-10) */
    --z-base: 1;
    /* Base layer for positioned elements */
    --z-dropdown-trigger: 4;
    /* Dropdown triggers */
    --z-sticky: 5;
    /* Sticky elements like table headers */
    --z-sticky-cell: 8;
    /* Sticky table cells */
    --z-dropdown: 10;
    /* Dropdown menus */
    --z-sticky-header: 15;
    /* Sticky column headers */

    /* Mid layers (100-999) */
    --z-popover: 100;
    /* Popovers, tooltips */
    --z-navbar: 998;
    /* Navigation bars */
    --z-sidebar: 999;
    /* Sidebars */
    --z-header: 1000;
    /* Headers and main navigation */
    --z-sidebar-backdrop: 1001;
    /* Sidebar backdrop overlay */
    --z-sidebar-panel: 1002;
    /* Sidebar panel when open */

    /* High layers (1000-9999) */
    --z-modal-backdrop: 1000;
    /* Modal backdrop */
    --z-modal: 1000;
    /* Modal content */
    --z-loader: 1200;
    /* Loading overlays */
    --z-dropdown-in-modal: 2000;
    /* Dropdowns within modals */

    /* Critical layers (9999+) */
    --z-notification: 9999;
    /* Notifications and toasts */
    --z-modal-high: 10000;
    /* High priority modals */
    --z-modal-critical: 10001;
    /* Critical modals (errors, alerts) */
    --z-max: 99999;
    /* Maximum z-index for inline critical overrides */

    /* Client View Specific */
    --client-header-height: 70px;
    --tab-height: 48px;

    /* Dashboard Specific */
    --dashboard-metric-primary: var(--color-primary);
    --dashboard-metric-danger: var(--color-danger);
    --dashboard-metric-success: var(--color-success);
    --dashboard-metric-info: var(--color-info);
    --dashboard-activity-bg: var(--color-surface);
    --dashboard-hover-bg: var(--color-surface-hover);
    --dashboard-stat-bg: var(--color-surface);
    --dashboard-refresh-icon: var(--color-text-secondary);
    --dashboard-last-updated: var(--color-text-muted);

    /* Extended palette + legacy compatibility tokens */
    --color-bg-light: var(--color-surface);
    --color-bg-secondary: var(--color-card-bg);
    --color-bg-hover: var(--color-surface-hover);
    --color-bg-dark: var(--color-border);
    --color-background-secondary: var(--color-bg-secondary);
    --color-background-hover: var(--color-bg-hover);
    --color-surface-alt: var(--color-card-bg);

    --bg-light: var(--color-bg-light);
    --bg-secondary: var(--color-bg-secondary);
    --bg-hover: var(--color-bg-hover);

    --border-color: var(--color-border);
    --border-light: var(--color-border-light);
    --border-radius: var(--radius-md);
    --color-border-dark: var(--color-border);

    --color-primary-light: var(--color-primary-bg);
    --color-primary-soft: var(--color-primary-bg);
    --color-primary-rgb: 59, 130, 246;
    --color-success-hover: var(--color-success);
    --color-success-light: var(--color-success-bg);
    --color-warning-light: var(--color-warning-bg);
    --color-danger-bg: rgba(239, 68, 68, 0.12);
    --color-danger-light: var(--color-danger-bg);
    --color-text-tertiary: var(--color-text-muted);
    --color-error: var(--color-danger);

    --danger-color: var(--color-danger);
    --success-color: var(--color-success);
    --primary: var(--color-primary);
    --primary-color: var(--color-primary);
    --primary-dark: var(--color-primary-hover);
    --primary-light: var(--color-primary-light);

    --text-primary: var(--color-text-primary);
    --text-secondary: var(--color-text-secondary);
    --dashboard-metric-warning: var(--color-warning);

    --font-size-md: 1rem;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-mono: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

    --spacing-xxl: 4rem;
    --spacing-4xl: 6rem;

    --radius-xs: 0.125rem;
    --radius-base: var(--radius-md);

    --shadow-xs: 0 1px 2px 0 rgb(15 23 42 / 0.04), 0 1px 1px -1px rgb(15 23 42 / 0.08);

    --transition-normal: var(--transition-base);

    --white: #ffffff;

}

/* Dark Theme */
[data-theme="dark"] {
    --color-primary-rgb: 96, 165, 250;

    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-surface-hover: #334155;
    --color-text: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #64748b;
    --color-text-primary: var(--color-text);
    --color-background: var(--color-surface);
    --color-primary-dark: var(--color-primary);
    --color-primary: #60a5fa;
    --color-primary-hover: #3b82f6;
    --color-border: #334155;
    --color-border-light: #1e293b;
    --gradient-primary: linear-gradient(135deg, #60a5fa 0%, #60a5fa 100%);

    /* Input and Card Backgrounds */
    --color-card-bg: #1e293b;
    --color-input-bg: #0f172a;
    --color-input-text: #f1f5f9;

    /* Tinted Backgrounds for Icons */
    --color-primary-bg: rgba(96, 165, 250, 0.1);
    --color-success-bg: rgba(34, 197, 94, 0.1);
    --color-warning-bg: rgba(245, 158, 11, 0.1);
    --color-info-bg: rgba(6, 182, 212, 0.1);

    /* Client Header */
    --client-header-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --client-header-text: #f1f5f9;

    /* Info and secondary colors for dark theme */
    --color-info: #3abff8;
    --color-secondary: #475569;
    --color-secondary-hover: #64748b;
    --color-secondary-bg: rgba(71, 85, 105, 0.2);

    /* Leave button colors */
    --color-leave: #64B5F6;
    --color-leave-hover: #42A5F5;
    --color-leave-gradient-start: #90CAF9;
    --color-leave-gradient-end: #42A5F5;

    /* Dashboard Specific */
    --dashboard-metric-primary: var(--color-primary);
    --dashboard-metric-danger: #f87171;
    --dashboard-metric-success: #4ade80;
    --dashboard-metric-info: var(--color-info);
    --dashboard-activity-bg: rgba(30, 41, 59, 0.5);
    --dashboard-hover-bg: var(--color-surface-hover);
    --dashboard-stat-bg: rgba(30, 41, 59, 0.3);
    --dashboard-refresh-icon: var(--color-text-secondary);
    --dashboard-last-updated: var(--color-text-muted);
}

/* Minimal Theme */
[data-theme="minimal"] {
    --color-primary-rgb: 23, 23, 23;

    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-surface-hover: #f5f5f5;
    --color-text: #171717;
    --color-text-secondary: #525252;
    --color-text-muted: #a3a3a3;
    --color-text-primary: var(--color-text);
    --color-background: var(--color-surface);
    --color-primary-dark: var(--color-primary-hover);
    --color-primary: #171717;
    --color-primary-hover: #404040;
    --color-border: #e5e5e5;
    --color-border-light: #f5f5f5;
    --gradient-primary: linear-gradient(135deg, #171717 0%, #171717 100%);

    /* Input and Card Backgrounds */
    --color-card-bg: #ffffff;
    --color-input-bg: #ffffff;
    --color-input-text: #171717;

    /* Tinted Backgrounds for Icons */
    --color-primary-bg: #f5f5f5;
    --color-success-bg: #f0fdf4;
    --color-warning-bg: #fffbeb;
    --color-info-bg: #f0fdfa;

    /* Client Header */
    --client-header-gradient: linear-gradient(135deg, #262626 0%, #171717 100%);
    --client-header-text: #ffffff;

    /* Info and secondary colors for minimal theme */
    --color-info: #0ea5e9;
    --color-secondary: #64748b;
    --color-secondary-hover: #475569;
    --color-secondary-bg: #f1f5f9;

    /* Leave button colors */
    --color-leave: #0ea5e9;
    --color-leave-hover: #0284c7;
    --color-leave-gradient-start: #38bdf8;
    --color-leave-gradient-end: #0284c7;

    /* Dashboard Specific */
    --dashboard-metric-primary: var(--color-primary);
    --dashboard-metric-danger: var(--color-danger);
    --dashboard-metric-success: var(--color-success);
    --dashboard-metric-info: var(--color-info);
    --dashboard-activity-bg: var(--color-surface);
    --dashboard-hover-bg: var(--color-surface-hover);
    --dashboard-stat-bg: #fafafa;
    --dashboard-refresh-icon: var(--color-text-secondary);
    --dashboard-last-updated: var(--color-text-muted);
}

/* Sage Green Theme */
[data-theme="sage"] {
    --color-primary-rgb: 127, 181, 142;

    --color-bg: #ECF3EE;
    /* pale sage wash */
    --color-surface: #F7FBF9;
    /* soft green-tinted surface */
    --color-surface-hover: #E2ECE6;
    /* deeper sage on hover */

    --color-text: #0F1A14;
    /* deep green-black for strong contrast */
    --color-text-secondary: #2F4A3C;
    /* dark sage */
    --color-text-muted: #6D8478;
    --color-text-primary: var(--color-text);
    --color-background: var(--color-surface);
    --color-primary-dark: var(--color-primary-hover);
    /* muted sage/grey */

    --color-primary: #7FB58E;
    /* true sage green */
    --color-primary-hover: #6AA37C;
    /* a bit deeper on hover */

    --color-border: #C9DED3;
    /* light sage border */
    --color-border-light: #EAF2ED;
    /* extra light sage */

    --gradient-primary: linear-gradient(135deg, #7FB58E 0%, #6AA37C 100%);

    /* Input and Card Backgrounds */
    --color-card-bg: #F7FBF9;
    --color-input-bg: #FFFFFF;
    --color-input-text: #0F1A14;

    /* Tinted Backgrounds for Icons */
    --color-primary-bg: #E8F3EC;
    --color-success-bg: #E8F5E8;
    --color-warning-bg: #FFF9F0;
    --color-info-bg: #EAF7F5;

    /* Client Header */
    --client-header-gradient: linear-gradient(135deg, #6AA37C 0%, #5A8D6B 100%);
    --client-header-text: #ffffff;

    /* Info and secondary colors for sage theme */
    --color-info: #22d3ee;
    --color-secondary: #78716c;
    --color-secondary-hover: #57534e;
    --color-secondary-bg: #f5f5f4;

    /* Leave button colors */
    --color-leave: #10B981;
    --color-leave-hover: #059669;
    --color-leave-gradient-start: #34D399;
    --color-leave-gradient-end: #059669;

    /* Dashboard Specific */
    --dashboard-metric-primary: var(--color-primary);
    --dashboard-metric-danger: #dc2626;
    --dashboard-metric-success: #65a30d;
    --dashboard-metric-info: var(--color-info);
    --dashboard-activity-bg: rgba(231, 243, 236, 0.5);
    --dashboard-hover-bg: var(--color-surface-hover);
    --dashboard-stat-bg: rgba(231, 243, 236, 0.3);
    --dashboard-refresh-icon: var(--color-text-secondary);
    --dashboard-last-updated: var(--color-text-muted);
}

/* Cyber Theme - Neon Electric Blue & Teal */
[data-theme="cyber"] {
    --color-primary-rgb: 0, 217, 255;

    --color-bg: #0A0E1B;
    /* deep space blue background */
    --color-surface: #0F1729;
    /* dark navy surface */
    --color-surface-hover: #1A2642;
    /* lighter navy on hover */

    --color-text: #E0F7FF;
    /* electric ice white */
    --color-text-secondary: #7DD3FC;
    /* bright sky blue */
    --color-text-muted: #38BDF8;
    /* vibrant blue */

    --color-primary: #00D9FF;
    /* neon cyan */
    --color-primary-hover: #00B8E6;
    /* deeper cyan on hover */

    --color-border: #1E3A5F;
    /* steel blue border */
    --color-border-light: #162841;
    /* dark blue border */

    --gradient-primary: linear-gradient(135deg, #00D9FF 0%, #0891B2 100%);

    /* Input and Card Backgrounds */
    --color-card-bg: #111827;
    --color-input-bg: #0C1222;
    --color-input-text: #E0F7FF;

    /* Tinted Backgrounds for Icons */
    --color-primary-bg: rgba(0, 217, 255, 0.1);
    --color-success-bg: rgba(52, 211, 153, 0.1);
    --color-warning-bg: rgba(251, 191, 36, 0.1);
    --color-info-bg: rgba(14, 165, 233, 0.1);

    /* Client Header */
    --client-header-gradient: linear-gradient(135deg, #0891B2 0%, #065A75 100%);
    --client-header-text: #E0F7FF;

    /* Additional theme-specific variables - Optimized */
    --color-surface-elevated: #1A2642;
    --color-primary-dark: #0891B2;
    --color-text-primary: #E0F7FF;
    /* Semantic shadows for dark theme */
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-default: 0 4px 6px rgba(0, 0, 0, 0.25);
    --shadow-elevated: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-overlay: 0 20px 30px rgba(0, 0, 0, 0.35);

    /* Info and secondary colors for cyber theme */
    --color-info: #22D3EE;
    --color-secondary: #475569;
    --color-secondary-hover: #64748B;
    --color-secondary-bg: rgba(71, 85, 105, 0.3);

    /* Leave button colors */
    --color-leave: #00D9FF;
    --color-leave-hover: #00B4E6;
    --color-leave-gradient-start: #22D3EE;
    --color-leave-gradient-end: #0891B2;

    /* Status colors */
    --color-success: #34D399;
    --color-warning: #FBBF24;
    --color-danger: #F87171;

    /* Dashboard Specific */
    --dashboard-metric-primary: var(--color-primary);
    --dashboard-metric-danger: #F87171;
    --dashboard-metric-success: #34D399;
    --dashboard-metric-info: #22D3EE;
    --dashboard-activity-bg: rgba(15, 23, 41, 0.7);
    --dashboard-hover-bg: rgba(26, 38, 66, 0.8);
    --dashboard-stat-bg: rgba(15, 23, 41, 0.5);
    --dashboard-refresh-icon: var(--color-text-secondary);
    --dashboard-last-updated: var(--color-text-muted);
}

/* Cyber theme special effects - Optimized for performance */
[data-theme="cyber"] .dashboard__button--primary,
[data-theme="cyber"] .modal__button--primary,
[data-theme="cyber"] .client__add-button {
    /* Use simpler shadows for better performance */
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.25);
    border: 1px solid rgba(0, 217, 255, 0.5);
    /* Enable GPU acceleration */
    will-change: box-shadow, transform;
    transform: translateZ(0);
}

[data-theme="cyber"] .dashboard__button--primary:hover,
[data-theme="cyber"] .modal__button--primary:hover,
[data-theme="cyber"] .client__add-button:hover {
    /* Reduced shadow complexity */
    box-shadow: 0 0 18px rgba(0, 217, 255, 0.4);
    transform: translateY(-2px) translateZ(0);
}

[data-theme="cyber"] input:focus,
[data-theme="cyber"] select:focus,
[data-theme="cyber"] textarea:focus {
    border-color: var(--color-primary);
    /* Simplified focus shadow */
    box-shadow: 0 0 8px rgba(0, 217, 255, 0.25);
}

:root {
    --modal-backdrop: rgba(15, 23, 42, 0.5);
}