/* ============================================
   BRILLIANT DESIGN SYSTEM
   Dark theme + Gamification + Modern UI
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    /* Background Colors */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-card-hover: #252525;
    --bg-elevated: #2a2a2a;

    /* Border Colors */
    --border-subtle: #2a2a2a;
    --border-medium: #3a3a3a;
    --border-accent: #4a4a4a;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #6a6a6a;

    /* Accent Colors */
    --accent-blue: #5b7cff;
    --accent-purple: #8b5cf6;
    --accent-gold: #ffd700;
    --accent-green: #00ff7f;
    --accent-orange: #ffb347;
    --accent-rose: #fb7185;
    --accent-emerald: #34d399;
    --accent-indigo: #6366f1;

    /* Gradient Colors */
    --gradient-purple-orange: linear-gradient(90deg, #a78bfa 0%, #ffb347 100%);
    --gradient-blue-purple: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-green: linear-gradient(135deg, #86efac 0%, #22c55e 100%);

    /* Status Colors */
    --status-success: #22c55e;
    --status-error: #ef4444;
    --status-warning: #f59e0b;
    --status-info: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(91, 124, 255, 0.3);

    /* Spacing System */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
}

/* ===== LIGHT MODE THEME ===== */
:root[data-theme="light"] {
    /* Background Colors - matching concept-engine aesthetic */
    --bg-primary: #f0f0f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f9f9fb;
    --bg-elevated: #fafafa;

    /* Border Colors - subtle and clean */
    --border-subtle: #e8e8ed;
    --border-medium: #d1d1d6;
    --border-accent: #aeaeb2;

    /* Text Colors - crisp and readable */
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #8e8e93;

    /* Shadows - soft and subtle */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(91, 124, 255, 0.2);
}

/* Light mode specific enhancements - concept-engine style */
:root[data-theme="light"] .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid #e8e8ed;
}

:root[data-theme="light"] .card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    border-color: #d1d1d6;
}

:root[data-theme="light"] .subject-card {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8e8ed;
}

:root[data-theme="light"] .subject-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    border-color: #d1d1d6;
}

:root[data-theme="light"] .btn-primary {
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(91, 124, 255, 0.25);
}

:root[data-theme="light"] .btn-primary:hover {
    box-shadow: 0 4px 12px rgba(91, 124, 255, 0.35);
}

:root[data-theme="light"] .btn-secondary {
    background-color: #f9f9fb;
    border: 1px solid #d1d1d6;
    color: #1d1d1f;
}

:root[data-theme="light"] .btn-secondary:hover {
    background-color: #f0f0f5;
    border-color: #aeaeb2;
}

:root[data-theme="light"] .navbar {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid #e8e8ed;
}

:root[data-theme="light"] .sidebar .card {
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8e8ed;
}

:root[data-theme="light"] .xp-card,
:root[data-theme="light"] .streak-card {
    background: #ffffff;
    border: 1px solid #e8e8ed;
}

:root[data-theme="light"] .badge-recommended {
    background-color: rgba(91, 124, 255, 0.12);
    color: #5b7cff;
    border: 1px solid rgba(91, 124, 255, 0.2);
}

:root[data-theme="light"] .badge-new {
    background-color: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

:root[data-theme="light"] .badge-level {
    background-color: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

:root[data-theme="light"] .stat-badge {
    background-color: #ffffff;
    border: 1px solid #e8e8ed;
}

:root[data-theme="light"] .container {
    background-color: var(--bg-primary);
}

:root[data-theme="light"] .main-content {
    background-color: transparent;
}

:root[data-theme="light"] .question-card {
    border: 1px solid #e8e8ed;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .question-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d1d1d6;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* ===== NAVIGATION ===== */
.navbar {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-purple-orange);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.stat-badge {
    background-color: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 600;
    transition: all 0.2s;
}

.stat-badge:hover {
    border-color: var(--border-accent);
    transform: translateY(-1px);
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl);
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--space-xl);
}

/* ===== CARDS ===== */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    transition: all 0.2s;
}

.card:hover {
    border-color: var(--border-medium);
}

.card-elevated {
    background-color: var(--bg-elevated);
    box-shadow: var(--shadow-md);
}

/* ===== BUTTONS ===== */
.btn {
    border: none;
    border-radius: var(--radius-full);
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn-primary {
    background-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: #4a6eff;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background-color: var(--bg-card);
    border-color: var(--border-accent);
}

.btn-gradient {
    background: var(--gradient-purple-orange);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-gradient:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-large {
    width: 100%;
    padding: var(--space-lg) var(--space-xl);
    font-size: 1.125rem;
    justify-content: center;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-recommended {
    background-color: rgba(91, 124, 255, 0.2);
    color: var(--accent-blue);
}

.badge-level {
    background-color: rgba(139, 92, 246, 0.2);
    color: var(--accent-purple);
}

.badge-new {
    background-color: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

/* ===== SIDEBAR ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Streak Card */
.streak-card {
    margin-bottom: 0;
}

.streak-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.streak-count {
    font-size: 3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.streak-icon {
    font-size: 2rem;
    animation: flicker 2s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.streak-days {
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
}

.day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    flex: 1;
}

.day-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--bg-elevated);
    border: 2px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    opacity: 0.3;
    transition: all 0.3s;
}

.day.active .day-icon {
    background: var(--gradient-purple-orange);
    border-color: var(--accent-gold);
    opacity: 1;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.day-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Premium Card */
.premium-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.premium-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

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

.premium-header {
    display: flex;
    gap: var(--space-md);
    align-items: start;
    margin-bottom: var(--space-lg);
    position: relative;
    z-index: 1;
}

.premium-icon {
    font-size: 2rem;
}

/* XP Progress Card */
.xp-card {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.xp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.xp-progress {
    width: 100%;
    height: 12px;
    background-color: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.xp-progress-bar {
    height: 100%;
    background: var(--gradient-green);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.subject-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

@media (max-width: 900px) {
    .subject-grid {
        grid-template-columns: 1fr;
    }
}

.subject-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 280px;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-purple-orange);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.subject-card:hover::before {
    transform: scaleX(1);
}

.subject-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.subject-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.subject-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.subject-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--space-md);
}

.subject-stats {
    display: flex;
    gap: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* ===== UTILITIES ===== */
.text-gradient {
    background: var(--gradient-purple-orange);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        padding: var(--space-lg);
        gap: var(--space-lg);
    }

    .sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--space-md);
    }

    .sidebar .card {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    /* Navigation */
    .navbar {
        border-bottom: 2px solid var(--border-subtle);
    }

    .nav-container {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .nav-logo {
        font-size: 1.25rem;
        font-weight: 700;
    }

    .nav-right {
        gap: 0.75rem;
    }

    /* Stat badges - bigger and more prominent on mobile */
    .stat-badge {
        padding: 0.5rem 0.75rem;
        font-size: 1.125rem;
        font-weight: 700;
        min-width: auto;
        border: 2px solid var(--border-medium);
    }

    .stat-badge span:first-child {
        font-size: 1.25rem;
    }

    .stat-badge span:last-child {
        font-size: 1.5rem;
    }

    /* Container */
    .container {
        padding: 0;
        gap: 0;
        grid-template-columns: 1fr;
    }

    /* Hide sidebar on mobile - show stats in a banner instead */
    .sidebar {
        display: none;
    }

    .main-content {
        padding: var(--space-md);
    }

    /* Streak card */
    .streak-count {
        font-size: 2.5rem;
    }

    .day-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .day-label {
        font-size: 0.75rem;
    }

    /* Subject grid - single card carousel view on mobile */
    .subject-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: var(--space-md);
        padding: var(--space-md);
        margin: 0 calc(-1 * var(--space-md));
        -webkit-overflow-scrolling: touch;
    }

    .subject-card {
        flex: 0 0 90%;
        scroll-snap-align: center;
        padding: var(--space-2xl);
        min-height: 400px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        border: 2px solid var(--border-medium);
    }

    .subject-card:hover {
        transform: none;
    }

    .subject-icon {
        font-size: 4rem;
        margin-bottom: var(--space-lg);
    }

    .subject-title {
        font-size: 1.5rem;
        margin-bottom: var(--space-sm);
    }

    .subject-subtitle {
        font-size: 0.9375rem;
        margin-bottom: var(--space-xl);
    }

    .subject-stats {
        margin-top: auto;
        padding-top: var(--space-xl);
        border-top: 1px solid var(--border-subtle);
    }

    /* Typography */
    h1 {
        font-size: 1.75rem;
        margin-bottom: var(--space-md);
    }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1rem; }

    /* Carousel indicators */
    .carousel-indicators {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        padding: var(--space-lg) 0;
    }

    .carousel-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background-color: var(--border-medium);
        transition: all 0.3s;
    }

    .carousel-dot.active {
        background-color: var(--accent-blue);
        width: 32px;
        border-radius: var(--radius-full);
    }

    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9375rem;
    }

    .btn-secondary {
        display: none; /* Hide secondary buttons on mobile */
    }

    .btn-large {
        padding: 1rem 2rem;
        font-size: 1.125rem;
        border-radius: var(--radius-2xl);
    }

    .btn-gradient {
        padding: 1rem 2rem;
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    /* Extra small mobile */
    .nav-container {
        padding: var(--space-sm);
    }

    .nav-logo {
        font-size: 1.125rem;
    }

    .container {
        padding: var(--space-sm);
        gap: var(--space-sm);
    }

    .sidebar {
        gap: var(--space-sm);
    }

    .sidebar .card {
        padding: var(--space-md);
    }

    .card {
        padding: var(--space-md);
    }

    /* Streak card - more compact */
    .streak-count {
        font-size: 2rem;
    }

    .streak-days {
        gap: var(--space-xs);
    }

    .day-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .day-label {
        font-size: 0.7rem;
    }

    /* Subject cards */
    .subject-card {
        padding: var(--space-md);
    }

    .subject-icon {
        font-size: 2rem;
    }

    .subject-title {
        font-size: 1rem;
    }

    .subject-subtitle {
        font-size: 0.8rem;
    }

    .subject-stats {
        gap: var(--space-sm);
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    /* Typography */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }

    /* Premium card */
    .premium-icon {
        font-size: 1.5rem;
    }

    .premium-header h5 {
        font-size: 0.875rem;
    }

    .premium-header p {
        font-size: 0.75rem;
    }

    /* Buttons - full width on very small screens */
    .btn {
        padding: 0.25rem 0.625rem;
        font-size: 0.75rem;
    }

    .btn-secondary {
        padding: 0.25rem 0.625rem;
        font-size: 0.75rem;
    }

    .btn-large {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .btn-gradient {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .stat-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Make nav logo smaller */
    .nav-logo {
        font-size: 1rem;
    }
}
