/**
 * ========================================
 * THEME COLOR SYSTEM
 * ========================================
 * 
 * Единственный источник цветовых переменных для тем.
 * НЕ дублирует стили компонентов из design-system.css.
 * Только определяет CSS-переменные для light/dark тем.
 */

/* ========================================
   LIGHT THEME
   ======================================== */

[data-theme="light"],
.light {
    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #6b7280;
    --text-inverse: #ffffff;
    
    /* Background/Surface Colors */
    --surface-primary: #ffffff;
    --surface-secondary: #f8fafc;
    --surface-tertiary: #f1f5f9;
    --surface-muted: #e2e8f0;
    
    /* Border Colors */
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
    --border-muted: #f1f5f9;
    
    /* Brand Colors */
    --brand-primary: #007AFF;
    --brand-primary-hover: #0051D5;
    --brand-primary-light: rgba(0, 122, 255, 0.1);
    --brand-primary-lighter: rgba(0, 122, 255, 0.05);
    --brand-secondary: #8b5cf6;
    --brand-secondary-hover: #7c3aed;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
    --gradient-secondary: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    --gradient-brand: linear-gradient(135deg, #007AFF 0%, #8b5cf6 100%);
    
    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    /* 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);
    
    /* Compatibility with design-system.css */
    --color-bg: #ffffff;
    --color-surface: #f9fafb;
    --color-surface-elevated: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #111827;
    --color-text-muted: #6b7280;
    --color-text-secondary: #4b5563;
}

/* ========================================
   DARK THEME
   ======================================== */

[data-theme="dark"],
.dark {
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #1a1a1a;
    
    /* Background/Surface Colors */
    --surface-primary: #0f172a;
    --surface-secondary: #1e293b;
    --surface-tertiary: #334155;
    --surface-muted: #475569;
    
    /* Border Colors */
    --border-primary: #334155;
    --border-secondary: #475569;
    --border-muted: #1e293b;
    
    /* Brand Colors (adjusted for dark) */
    --brand-primary: #0A84FF;
    --brand-primary-hover: #409CFF;
    --brand-primary-light: rgba(10, 132, 255, 0.15);
    --brand-primary-lighter: rgba(10, 132, 255, 0.08);
    --brand-secondary: #a78bfa;
    --brand-secondary-hover: #8b5cf6;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #0A84FF 0%, #409CFF 100%);
    --gradient-secondary: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    --gradient-brand: linear-gradient(135deg, #0A84FF 0%, #a78bfa 100%);
    
    /* Status Colors (same, good contrast on dark) */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    /* Shadows (stronger for dark theme) */
    --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.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    
    /* Compatibility with design-system.css */
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-surface-elevated: #334155;
    --color-border: #475569;
    --color-text: #f8fafc;
    --color-text-muted: #cbd5e1;
    --color-text-secondary: #94a3b8;
}

/* ========================================
   SYSTEM THEME (follows OS preference)
   ======================================== */

[data-theme="system"] {
    color-scheme: light dark;
}

/* ========================================
   THEME-SPECIFIC COMPONENT OVERRIDES
   ======================================== */

/* Only override where design-system.css uses wrong variables */

/* Text muted override */
.text-muted {
    color: var(--text-muted) !important;
}

/* ========================================
   THEME TRANSITION SMOOTHING
   ======================================== */

/* Base transition for all elements during theme change */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Disable transitions during theme switching for performance */
.theme-switching * {
    transition: none !important;
}

/* ========================================
   MOBILE/RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    /* Prevent zoom on iOS input focus */
    .form-control,
    .form-select {
        font-size: 16px;
    }
}
