/* Universal Theme System - Light/Dark Mode Toggle */

/* Light Theme (Default) */
:root {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-tertiary: #F1F5F9;
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 10px 25px rgba(0, 0, 0, 0.15);
    --accent-primary: #6366F1;
    --accent-secondary: #8B5CF6;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --error-color: #EF4444;
    --theme-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --border-color: #475569;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-heavy: 0 10px 25px rgba(0, 0, 0, 0.5);
    --accent-primary: #818CF8;
    --accent-secondary: #A78BFA;
    --success-color: #34D399;
    --warning-color: #FBBF24;
    --error-color: #F87171;
}

/* Sticky Theme Toggle Button */
.theme-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    transition: var(--theme-transition);
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--theme-transition);
    box-shadow: var(--shadow-medium);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-heavy);
    border-color: var(--accent-primary);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

/* Theme Icon Styles */
.theme-icon {
    font-size: 1.5rem;
    transition: var(--theme-transition);
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon.sun {
    color: #F59E0B;
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-icon.moon {
    color: #6366F1;
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

/* Dark theme icon states */
[data-theme="dark"] .theme-icon.sun {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

[data-theme="dark"] .theme-icon.moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Subtle glow effect for dark mode */
[data-theme="dark"] .theme-toggle-btn {
    box-shadow: var(--shadow-medium), 0 0 20px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .theme-toggle-btn:hover {
    box-shadow: var(--shadow-heavy), 0 0 30px rgba(99, 102, 241, 0.3);
}

/* Theme toggle animation */
.theme-toggle-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.4s ease;
}

.theme-toggle-btn.animating::before {
    width: 200px;
    height: 200px;
    opacity: 0.3;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .theme-toggle-container {
        top: 15px;
        right: 15px;
    }
    
    .theme-toggle-btn {
        width: 48px;
        height: 48px;
    }
    
    .theme-icon {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .theme-toggle-container {
        top: 10px;
        right: 10px;
    }
    
    .theme-toggle-btn {
        width: 44px;
        height: 44px;
    }
    
    .theme-icon {
        font-size: 1.2rem;
    }
}

/* Accessibility improvements */
.theme-toggle-btn:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.theme-toggle-btn:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .theme-toggle-btn {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .theme-toggle-btn,
    .theme-icon,
    .theme-toggle-btn::before {
        transition: none;
        animation: none;
    }
    
    .theme-toggle-btn:hover {
        transform: none;
    }
    
    .theme-toggle-btn:active {
        transform: none;
    }
}

/* Theme-Aware Gaming Hub Card Fixes */
/* Add these styles to your gaming hub CSS or create a separate patch file */

/* Override hardcoded card backgrounds to use theme variables */
.game-section {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color) !important;
}

.game-section::before {
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary)) !important;
}

/* Update text colors to be theme-aware */
.section-title {
    color: var(--accent-primary) !important;
}

.section-description {
    color: var(--text-secondary) !important;
}

/* Update starfield for light theme */
.starfield {
    opacity: 1;
    transition: var(--theme-transition);
}

[data-theme="light"] .starfield {
    opacity: 0.3; /* Dim stars in light mode */
}

/* Update guild header for theme awareness */
.guild-header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--bg-secondary) 100%) !important;
    color: var(--text-primary) !important;
}

.guild-title {
    color: var(--text-primary) !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

[data-theme="light"] .guild-title {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.guild-subtitle {
    color: var(--text-secondary) !important;
}

/* Update section links for theme awareness */
.section-link {
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary)) !important;
    color: var(--text-primary) !important;
}

.section-link:hover {
    color: var(--text-primary) !important;
}

/* Fix body background for theme switching */
body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%) !important;
    color: var(--text-primary) !important;
}

/* Update floating particles for theme awareness */
[data-theme="light"] .starfield div {
    background-color: var(--accent-primary) !important;
    opacity: 0.4 !important;
}
