/* ============================================
   THEME SYSTEM - Multiple Theme Presets
   ============================================ */

:root {
    /* Default Dark Theme */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #ec4899;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Skeleton Loading */
    --skeleton-base: #1e293b;
    --skeleton-shine: #334155;
    
    /* Chart colors */
    --chart-bg: #0E1218;
    --chart-border: #333;
}

/* Light Theme */
body[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #ec4899;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --skeleton-base: #e2e8f0;
    --skeleton-shine: #f1f5f9;
    --chart-bg: #ffffff;
    --chart-border: #e2e8f0;
}

/* Cyberpunk Theme */
body[data-theme="cyberpunk"] {
    --bg-primary: #0a0e27;
    --bg-secondary: #141b3d;
    --bg-tertiary: #1e2749;
    --text-primary: #00ffff;
    --text-secondary: #ff00ff;
    --text-muted: #7c7c7c;
    --accent-primary: #ff00ff;
    --accent-secondary: #00ffff;
    --accent-tertiary: #ffff00;
    --border-color: rgba(255, 0, 255, 0.3);
    --shadow-color: rgba(255, 0, 255, 0.5);
    --success-color: #00ff00;
    --warning-color: #ffff00;
    --danger-color: #ff0066;
    --info-color: #00ffff;
    --skeleton-base: #141b3d;
    --skeleton-shine: #1e2749;
    --chart-bg: #0a0e27;
    --chart-border: #ff00ff;
}

/* Minimalist Theme */
body[data-theme="minimalist"] {
    --bg-primary: #fafafa;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #eeeeee;
    --text-primary: #212121;
    --text-secondary: #616161;
    --text-muted: #9e9e9e;
    --accent-primary: #000000;
    --accent-secondary: #424242;
    --accent-tertiary: #757575;
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.05);
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --info-color: #2196f3;
    --skeleton-base: #eeeeee;
    --skeleton-shine: #f5f5f5;
    --chart-bg: #ffffff;
    --chart-border: #eeeeee;
}

/* Ocean Theme */
body[data-theme="ocean"] {
    --bg-primary: #001f3f;
    --bg-secondary: #003d5c;
    --bg-tertiary: #005a7a;
    --text-primary: #e0f7fa;
    --text-secondary: #b2ebf2;
    --text-muted: #80deea;
    --accent-primary: #00bcd4;
    --accent-secondary: #26c6da;
    --accent-tertiary: #00acc1;
    --border-color: rgba(0, 188, 212, 0.2);
    --shadow-color: rgba(0, 188, 212, 0.3);
    --success-color: #26c6da;
    --warning-color: #ffb74d;
    --danger-color: #ef5350;
    --info-color: #29b6f6;
    --skeleton-base: #003d5c;
    --skeleton-shine: #005a7a;
    --chart-bg: #001f3f;
    --chart-border: #00bcd4;
}

/* Forest Theme */
body[data-theme="forest"] {
    --bg-primary: #1a2f1a;
    --bg-secondary: #2d4a2d;
    --bg-tertiary: #3f663f;
    --text-primary: #e8f5e9;
    --text-secondary: #c8e6c9;
    --text-muted: #a5d6a7;
    --accent-primary: #4caf50;
    --accent-secondary: #66bb6a;
    --accent-tertiary: #81c784;
    --border-color: rgba(76, 175, 80, 0.2);
    --shadow-color: rgba(76, 175, 80, 0.3);
    --success-color: #66bb6a;
    --warning-color: #ffa726;
    --danger-color: #ef5350;
    --info-color: #42a5f5;
    --skeleton-base: #2d4a2d;
    --skeleton-shine: #3f663f;
    --chart-bg: #1a2f1a;
    --chart-border: #4caf50;
}

/* High Contrast Theme (Accessibility) */
body[data-theme="high-contrast"] {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #333333;
    --text-primary: #ffffff;
    --text-secondary: #ffff00;
    --text-muted: #00ffff;
    --accent-primary: #ffff00;
    --accent-secondary: #00ff00;
    --accent-tertiary: #00ffff;
    --border-color: #ffffff;
    --shadow-color: rgba(255, 255, 255, 0.5);
    --success-color: #00ff00;
    --warning-color: #ffff00;
    --danger-color: #ff0000;
    --info-color: #00ffff;
    --skeleton-base: #1a1a1a;
    --skeleton-shine: #333333;
    --chart-bg: #000000;
    --chart-border: #ffffff;
}

/* Smooth Theme Transitions */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

* {
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Prevent transition on page load */
body.preload * {
    transition: none !important;
}

/* Custom Accent Color Support */
body[data-accent="blue"] {
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-tertiary: #93c5fd;
}

body[data-accent="purple"] {
    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --accent-tertiary: #c4b5fd;
}

body[data-accent="pink"] {
    --accent-primary: #ec4899;
    --accent-secondary: #f472b6;
    --accent-tertiary: #f9a8d4;
}

body[data-accent="green"] {
    --accent-primary: #10b981;
    --accent-secondary: #34d399;
    --accent-tertiary: #6ee7b7;
}

body[data-accent="orange"] {
    --accent-primary: #f59e0b;
    --accent-secondary: #fbbf24;
    --accent-tertiary: #fcd34d;
}

body[data-accent="red"] {
    --accent-primary: #ef4444;
    --accent-secondary: #f87171;
    --accent-tertiary: #fca5a5;
}

/* Font Size Adjustments (Accessibility) */
body[data-font-size="small"] {
    font-size: 14px;
}

body[data-font-size="medium"] {
    font-size: 16px;
}

body[data-font-size="large"] {
    font-size: 18px;
}

body[data-font-size="xlarge"] {
    font-size: 20px;
}

/* Reduced Motion (Accessibility) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Theme Selector Modal */
.theme-selector-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-selector-modal.active {
    display: flex;
    opacity: 1;
}

.theme-selector-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px var(--shadow-color);
}

.theme-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.theme-selector-header h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin: 0;
}

.theme-close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.theme-close-btn:hover {
    background: var(--bg-tertiary);
}

.theme-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.theme-preset-card {
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.theme-preset-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow-color);
}

.theme-preset-card.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.theme-preview {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    gap: 5px;
    padding: 10px;
}

.theme-preview-color {
    flex: 1;
    border-radius: 4px;
}

.theme-preset-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.accent-colors {
    margin-bottom: 30px;
}

.accent-colors h3 {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: 15px;
}

.accent-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.accent-color-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.accent-color-btn:hover {
    transform: scale(1.1);
}

.accent-color-btn.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 20px currentColor;
}

.accent-color-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.accent-color-btn.active::after {
    opacity: 1;
}

.accessibility-options {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.accessibility-options h3 {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: 20px;
}

.accessibility-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.accessibility-control label {
    color: var(--text-primary);
    font-size: 14px;
}

.font-size-slider {
    width: 200px;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
}

.font-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

.font-size-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--bg-tertiary);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch input {
    display: none;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-switch {
    background: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-switch::after {
    transform: translateX(24px);
}
