/**
 * PSO Sound Off - Dual Theme System
 * Dark Theme (After Dark Systems) + Light Theme
 */

/* ============================================================================
   DARK THEME (After Dark Systems) - DEFAULT
   ============================================================================ */
:root[data-theme="dark"],
:root {
    /* Backgrounds */
    --bg-primary: #0f0f1e;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252541;
    --bg-hover: #2d2d4a;
    --bg-card: #1a1a2e;

    /* Text Colors */
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --text-tertiary: #707088;
    --text-heading: #ffffff;

    /* Brand Colors */
    --brand-primary: #667eea;
    --brand-secondary: #764ba2;
    --brand-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Accent Colors */
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;

    /* Border Colors */
    --border-color: #2d2d4a;
    --border-light: #3a3a58;

    /* Status Colors */
    --success-bg: #064e3b;
    --success-text: #6ee7b7;
    --info-bg: #1e3a8a;
    --info-text: #93c5fd;
    --warning-bg: #78350f;
    --warning-text: #fbbf24;
    --danger-bg: #7f1d1d;
    --danger-text: #fca5a5;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* ============================================================================
   LIGHT THEME
   ============================================================================ */
:root[data-theme="light"] {
    /* Backgrounds */
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --bg-hover: #f0f2f5;
    --bg-card: #ffffff;

    /* Text Colors */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --text-heading: #1a1a1a;

    /* Brand Colors (same) */
    --brand-primary: #667eea;
    --brand-secondary: #764ba2;
    --brand-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Accent Colors */
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;

    /* Border Colors */
    --border-color: #e9ecef;
    --border-light: #f0f0f0;

    /* Status Colors */
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --info-bg: #dbeafe;
    --info-text: #1e40af;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --danger-bg: #fce7f3;
    --danger-text: #9f1239;

    /* 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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.2);
}

/* ============================================================================
   THEME TOGGLE BUTTON
   ============================================================================ */
#theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    overflow: hidden;
}

#theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
    border-color: var(--brand-primary);
}

#theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    position: absolute;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark theme: show moon, hide sun */
:root[data-theme="dark"] .theme-icon-dark {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

:root[data-theme="dark"] .theme-icon-light {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

/* Light theme: show sun, hide moon */
:root[data-theme="light"] .theme-icon-dark {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

:root[data-theme="light"] .theme-icon-light {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ============================================================================
   BASE THEME STYLES
   ============================================================================ */
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Cards and Sections */
.stat-card,
.categories-section,
.sidebar-section,
.post-card,
.comment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.section-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    color: var(--text-heading);
}

/* Category Styles */
.category {
    border-bottom: 1px solid var(--border-color);
}

.category:hover {
    background: var(--bg-hover);
}

.category-name,
.category-name a {
    color: var(--text-heading);
}

.category-name a:hover {
    color: var(--brand-primary);
}

.category-description {
    color: var(--text-secondary);
}

.category-stats-number {
    color: var(--brand-primary);
}

.category-stats-label {
    color: var(--text-tertiary);
}

.category-latest {
    color: var(--text-secondary);
}

/* Badges */
.badge-public {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-members {
    background: var(--info-bg);
    color: var(--info-text);
}

.badge-private {
    background: var(--danger-bg);
    color: var(--danger-text);
}

/* Stats */
.stat-number {
    color: var(--brand-primary);
}

.stat-label {
    color: var(--text-secondary);
}

/* Recent Activity */
.activity-item {
    border-bottom: 1px solid var(--border-color);
}

.activity-item:hover {
    background: var(--bg-hover);
}

.activity-title a {
    color: var(--text-heading);
}

.activity-title a:hover {
    color: var(--brand-primary);
}

.activity-meta {
    color: var(--text-secondary);
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Links */
a {
    color: var(--brand-primary);
}

a:hover {
    color: var(--brand-secondary);
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

footer a {
    color: var(--brand-primary);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #theme-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        top: 15px;
        right: 15px;
    }
}
