/**
 * Theme Switcher Styles
 * Light/Dark theme switcher with smooth transitions
 */

/* Light Theme Variables - Softer, Warmer Palette */
:root[data-theme="light"] {
    --primary: #0077CC;
    --primary-hover: #0066B3;
    --secondary: #00B574;
    --secondary-hover: #009960;
    --warning: #F59E0B;
    --danger: #DC3545;
    --success: #10B981;
    
    /* Backgrounds - Softer, Warmer Tones */
    --bg-primary: #FAF9F7;      /* Soft warm white instead of pure white */
    --bg-secondary: #F5F3F0;     /* Light warm gray */
    --bg-tertiary: #EBE8E4;      /* Slightly darker warm gray */
    --bg-card: #FEFDFB;          /* Very soft off-white for cards */
    --bg-hover: #F0EDE9;         /* Subtle hover state */
    --bg-active: #E8E4DF;        /* Active state */
    
    /* Text Colors - Better Contrast */
    --text-primary: #1A1A1A;     /* Softer than pure black */
    --text-secondary: #3D3D3D;   /* Darker for better readability */
    --text-muted: #5A5A5A;       /* Still muted but readable */
    --text-light: #737373;       /* Light but visible */
    
    /* Borders - More Visible */
    --border-color: #D0CCC6;     /* Darker warm border for visibility */
    --border-light: #DDD9D3;     /* Medium warm border */
    --border-dark: #B8B4AD;      /* Even darker warm border */
    
    /* Shadows - Softer and Warmer */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 30px rgba(0, 0, 0, 0.12);
    
    /* Specific Components */
    --header-bg: rgba(250, 249, 247, 0.98);
    --header-border: rgba(0, 0, 0, 0.08);
    --card-bg: #FEFDFB;
    --input-bg: #FFFFFF;
    --input-border: #D4D0CA;
    --code-bg: #F0EDE9;
    --code-text: #2D5016;
    
    /* Gradients - Using Brand Colors */
    --gradient-primary: linear-gradient(135deg, #0077CC 0%, #00B574 100%);
    --gradient-success: linear-gradient(135deg, #00B574 0%, #00D9A3 100%);
    --gradient-info: linear-gradient(135deg, #0077CC 0%, #00A3FF 100%);
}

/* Dark Theme Variables (Enhanced) */
:root[data-theme="dark"],
:root {
    --primary: #00D9FF;
    --primary-hover: #00B8E6;
    --secondary: #00F5A0;
    --secondary-hover: #00D68A;
    --warning: #FFB800;
    --danger: #FF3838;
    --success: #00F5A0;
    --primary-solid: #00D9FF;
    
    /* Backgrounds */
    --bg-primary: #0A0F1C;
    --bg-secondary: #151B2C;
    --bg-tertiary: #1F2937;
    --bg-card: #151B2C;
    --bg-hover: #1F2937;
    --bg-active: #2A3344;
    
    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #E2E8F0;
    --text-muted: #8892B0;
    --text-light: #64748B;
    
    /* Borders */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.05);
    --border-dark: rgba(255, 255, 255, 0.2);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
    
    /* Specific Components */
    --header-bg: rgba(10, 15, 28, 0.95);
    --header-border: rgba(255, 255, 255, 0.1);
    --card-bg: #1F2937;
    --input-bg: #151B2C;
    --input-border: rgba(255, 255, 255, 0.2);
    --code-bg: #1F2937;
    --code-text: #00D9FF;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #00D9FF 0%, #00F5A0 100%);
    --gradient-success: linear-gradient(135deg, #00F5A0 0%, #00D9A3 100%);
    --gradient-info: linear-gradient(135deg, #00D9FF 0%, #0099FF 100%);
}

/* Theme Switcher Button */
.theme-switcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    background: var(--bg-card);
    border-radius: 30px;
    padding: 4px;
    box-shadow: var(--shadow-xl);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease-out;
}

.theme-switcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 35px rgba(0, 0, 0, 0.2);
}

.theme-switcher-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-primary);
    border-radius: 26px;
    padding: 8px;
    position: relative;
}

.theme-option {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    background: transparent;
    border: none;
    color: var(--text-muted);
}

.theme-option:hover {
    color: var(--primary);
}

.theme-option.active {
    color: #FFFFFF;
}

.theme-option svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.theme-option:hover svg {
    transform: scale(1.1);
}

/* Sliding indicator */
.theme-indicator {
    position: absolute;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    left: 8px;
}

[data-theme="dark"] .theme-indicator {
    transform: translateX(0);
}

[data-theme="light"] .theme-indicator {
    transform: translateX(46px);
}

/* Tooltip */
.theme-switcher-tooltip {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
}

.theme-switcher-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border: 6px solid transparent;
    border-top-color: var(--bg-card);
}

.theme-switcher:hover .theme-switcher-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .theme-switcher {
        bottom: 20px;
        right: 20px;
        transform: scale(0.9);
    }
    
    .theme-switcher-tooltip {
        display: none;
    }
}

/* Theme transition for all elements */
* {
    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 */
.no-transition * {
    transition: none !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Icon rotation animation when switching */
.theme-option.switching svg {
    animation: rotate 0.5s ease;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Pulse animation for first-time users */
.theme-switcher.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Theme-specific component updates */
[data-theme="light"] {
    /* Update existing dark-themed components */
    body {
        background: var(--bg-primary);
        color: var(--text-primary);
    }
    
    .site-header {
        background: var(--header-bg);
        border-bottom-color: var(--header-border);
    }
    
    .site-logo {
        color: var(--primary);
    }
    
    .main-navigation a {
        color: var(--text-secondary);
    }
    
    .main-navigation a:hover,
    .main-navigation .current-menu-item a {
        color: var(--primary);
    }
    
    /* Fix h2 and h3 headings */
    h1, h2, h3, h4, h5, h6 {
        color: var(--text-primary);
    }
    
    .features-section h2 {
        color: var(--text-primary);
    }
    
    /* Cards and containers */
    .feature-card {
        background: #FFFFFF;
        border: 1px solid #C8C4BE;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    }
    
    .feature-card:hover {
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(0, 119, 204, 0.12);
        transform: translateY(-3px);
    }
    
    .settings-section {
        background: var(--bg-card);
        border-color: var(--border-color);
        box-shadow: var(--shadow-sm);
    }
    
    /* Forms and inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        background: var(--input-bg);
        border-color: var(--input-border);
        color: var(--text-primary);
    }
    
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    textarea:focus,
    select:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
    }
    
    /* Buttons */
    .btn {
        background: var(--primary);
        color: #FFFFFF;
    }
    
    .btn:hover {
        background: var(--primary-hover);
    }
    
    .btn-secondary {
        background: var(--bg-tertiary);
        color: var(--text-primary);
    }
    
    .btn-secondary:hover {
        background: var(--bg-hover);
    }
    
    /* Code blocks */
    code, pre {
        background: var(--code-bg);
        color: var(--code-text);
    }
    
    /* Hero section */
    .hero-section {
        background: linear-gradient(135deg, #F8F6F3 0%, #FAF9F7 100%);
    }
    
    .hero-title {
        background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    
    .hero-description {
        color: var(--text-secondary);
    }
    
    .hero-stats .stat-item {
        color: var(--text-primary);
        background: #FFFFFF;
        border: 1px solid #E5E2DD;
        padding: 0.5rem 1rem;
        border-radius: 20px;
    }
    
    /* Footer */
    .site-footer {
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
    }
}