/* ===== KursBot Premium Design System ===== */
/* Modern, Mobile-first, Telegram WebApp optimized */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Brand Colors */
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5241C5;
    --primary-glow: rgba(108, 92, 231, 0.3);

    --accent: #00D2FF;
    --accent-light: #74E8FF;
    --accent-dark: #00A8CC;

    --success: #00B894;
    --success-light: #55EFC4;
    --warning: #FDCB6E;
    --warning-dark: #F39C12;
    --danger: #FF6B6B;
    --danger-light: #FF8A8A;

    /* Dark Theme (default) */
    --bg-primary: #0A0E1A;
    --bg-secondary: #111827;
    --bg-card: #1A1F35;
    --bg-card-hover: #222842;
    --bg-surface: rgba(26, 31, 53, 0.8);
    --bg-overlay: rgba(10, 14, 26, 0.85);
    --bg-glass: rgba(26, 31, 53, 0.6);
    --bg-input: #1E2340;

    --text-primary: #F1F2F6;
    --text-secondary: #A0A8C0;
    --text-muted: #6B7280;
    --text-accent: var(--primary-light);

    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-focus: var(--primary);

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px var(--primary-glow);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6C5CE7, #A29BFE);
    --gradient-accent: linear-gradient(135deg, #00D2FF, #6C5CE7);
    --gradient-hero: linear-gradient(135deg, #0A0E1A 0%, #1A1F35 50%, #2D1B69 100%);
    --gradient-card: linear-gradient(145deg, rgba(26,31,53,0.9), rgba(17,24,39,0.9));

    /* Spacing */
    --nav-height: 60px;
    --bottom-nav-height: 65px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #F5F7FB;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F0F2F8;
    --bg-surface: rgba(255,255,255,0.9);
    --bg-overlay: rgba(245,247,251,0.9);
    --bg-glass: rgba(255,255,255,0.7);
    --bg-input: #F0F2F8;

    --text-primary: #1A1F35;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --text-accent: var(--primary);

    --border: rgba(0,0,0,0.06);
    --border-light: rgba(0,0,0,0.1);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --gradient-hero: linear-gradient(135deg, #F5F7FB 0%, #E8ECF4 50%, #DDD6F3 100%);
    --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(240,242,248,0.9));
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary-light); text-decoration: none; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, textarea, select { font-family: inherit; outline: none; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ===== App Shell ===== */
#app {
    max-width: 100%;
    min-height: 100vh;
    position: relative;
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 10px);
}

/* ===== Top Header ===== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.header-logo {
    font-size: 1.3rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-btn {
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    font-size: 1.1rem;
}
.header-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.header-btn .badge {
    position: absolute; top: 2px; right: 2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--danger); color: #fff;
    font-size: 10px; display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    height: calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    display: flex; align-items: center; justify-content: space-around;
}

.nav-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 6px 12px;
    color: var(--text-muted);
    font-size: 0.65rem; font-weight: 500;
    transition: all 0.3s ease; background: none;
    position: relative;
}

.nav-item i { font-size: 1.25rem; transition: all 0.3s ease; }

.nav-item.active {
    color: var(--primary-light);
}
.nav-item.active i {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}
.nav-item.active::before {
    content: '';
    position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
    width: 24px; height: 3px; border-radius: 0 0 4px 4px;
    background: var(--gradient-primary);
}

/* ===== Page Container ===== */
.page { display: none; animation: fadeSlideIn 0.35s ease; }
.page.active { display: block; }

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

.page-content { padding: 16px; }

/* ===== Section Headers ===== */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; padding: 0 2px;
}
.section-title {
    font-size: 1.15rem; font-weight: 700;
    color: var(--text-primary);
}
.section-link {
    font-size: 0.8rem; font-weight: 600;
    color: var(--primary-light);
    display: flex; align-items: center; gap: 4px;
}

/* ===== Search Bar ===== */
.search-container {
    position: relative; margin-bottom: 20px;
}
.search-input {
    width: 100%; height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0 16px 0 48px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}
.search-input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}
.search-input::placeholder { color: var(--text-muted); }
.search-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 1rem;
}

/* ===== Categories Scroll ===== */
.categories-scroll {
    display: flex; gap: 10px;
    overflow-x: auto; padding: 2px 0 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.categories-scroll::-webkit-scrollbar { display: none; }

.category-chip {
    flex-shrink: 0;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem; font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}
.category-chip:hover, .category-chip.active {
    background: var(--gradient-primary);
    color: #fff; border-color: transparent;
    box-shadow: var(--shadow-glow);
}

/* ===== Course Cards ===== */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.course-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}
.course-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}
.course-card:active { transform: scale(0.97); }

.course-card-image {
    width: 100%; aspect-ratio: 16/10;
    object-fit: cover;
    background: var(--bg-card-hover);
}

.course-card-body { padding: 10px 12px 14px; }

.course-card-category {
    font-size: 0.65rem; font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.course-card-title {
    font-size: 0.85rem; font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.course-card-meta {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.7rem; color: var(--text-muted);
    margin-bottom: 8px;
}
.course-card-meta i { font-size: 0.65rem; }

.course-card-footer {
    display: flex; justify-content: space-between; align-items: center;
}

.course-price {
    font-size: 0.9rem; font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.course-price.free {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
}
.course-price-old {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-right: 4px;
}

.course-rating {
    display: flex; align-items: center; gap: 3px;
    font-size: 0.7rem; color: var(--warning);
}

/* ===== Featured Carousel ===== */
.featured-scroll {
    display: flex; gap: 14px;
    overflow-x: auto; padding: 2px 0 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.featured-scroll::-webkit-scrollbar { display: none; }

.featured-card {
    flex-shrink: 0;
    width: 280px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.featured-card:hover { transform: scale(1.02); }

.featured-card-image {
    width: 100%; height: 160px;
    object-fit: cover;
}
.featured-card-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 40px 14px 14px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
}
.featured-card-title {
    font-size: 0.95rem; font-weight: 700;
    color: #fff; margin-bottom: 4px;
}
.featured-card-meta {
    font-size: 0.7rem; color: rgba(255,255,255,0.7);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.9rem; font-weight: 600;
    transition: all 0.3s ease; position: relative;
    overflow: hidden;
}
.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 16px rgba(108,92,231,0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(108,92,231,0.4);
}
.btn-primary:active { transform: scale(0.97); }

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

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ===== Cards / Glass ===== */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.stat-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
}
.stat-value {
    font-size: 1.5rem; font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label {
    font-size: 0.7rem; color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Progress Bar ===== */
.progress-bar {
    height: 6px; background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.7rem; color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Course Detail Page ===== */
.course-hero {
    position: relative;
    margin: -16px -16px 0;
}
.course-hero-image {
    width: 100%; height: 220px;
    object-fit: cover;
}
.course-hero-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 60px 16px 16px;
    background: linear-gradient(transparent, var(--bg-primary));
}
.course-hero-play {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 60px; height: 60px;
    background: rgba(108,92,231,0.9);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.5rem;
    box-shadow: 0 0 30px rgba(108,92,231,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}
.course-hero-play:hover { transform: translate(-50%, -50%) scale(1.1); }

.course-detail-title {
    font-size: 1.3rem; font-weight: 800;
    line-height: 1.3; margin-bottom: 8px;
}

.course-stats {
    display: flex; gap: 16px; margin: 12px 0;
    flex-wrap: wrap;
}
.course-stat {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.8rem; color: var(--text-secondary);
}
.course-stat i { color: var(--primary-light); font-size: 0.85rem; }

.course-tabs {
    display: flex; gap: 0; margin: 20px 0 16px;
    border-bottom: 1px solid var(--border);
}
.course-tab {
    padding: 10px 16px;
    font-size: 0.85rem; font-weight: 600;
    color: var(--text-muted);
    background: none; border: none;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}
.course-tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
}

/* ===== Lesson List ===== */
.lesson-list { list-style: none; }
.lesson-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.lesson-item:hover { background: var(--bg-card-hover); }
.lesson-item.completed { border-left: 3px solid var(--success); }
.lesson-item.locked { opacity: 0.5; }

.lesson-number {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
    flex-shrink: 0;
}
.lesson-item.completed .lesson-number {
    background: var(--success);
    color: #fff;
}

.lesson-info { flex: 1; min-width: 0; }
.lesson-title {
    font-size: 0.85rem; font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lesson-duration {
    font-size: 0.7rem; color: var(--text-muted);
    margin-top: 2px;
}

.lesson-icon {
    color: var(--text-muted); font-size: 0.9rem;
}
.lesson-item.completed .lesson-icon { color: var(--success); }

/* ===== Video Player ===== */
.video-container {
    position: relative;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
    aspect-ratio: 16/9;
}
.video-container video {
    width: 100%; height: 100%;
    object-fit: contain;
}

.video-controls {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 30px 12px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    display: flex; flex-direction: column; gap: 6px;
}

.video-progress {
    width: 100%; height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}
.video-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.video-btns {
    display: flex; align-items: center; justify-content: space-between;
}
.video-btn {
    background: none; color: #fff;
    font-size: 1rem; padding: 4px 8px;
}
.video-time { font-size: 0.7rem; color: rgba(255,255,255,0.8); }

.video-speed-menu {
    position: absolute; bottom: 50px; right: 10px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 6px; display: none;
    box-shadow: var(--shadow-lg);
}
.video-speed-menu.show { display: block; }
.speed-option {
    padding: 8px 16px;
    font-size: 0.8rem; color: var(--text-primary);
    background: none; width: 100%;
    text-align: center; border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.speed-option:hover, .speed-option.active {
    background: var(--primary);
    color: #fff;
}

/* ===== Profile Page ===== */
.profile-header {
    text-align: center; padding: 20px 0;
}
.profile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 12px;
    border: 3px solid var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}
.profile-avatar-placeholder {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700; color: #fff;
    margin: 0 auto 12px;
}
.profile-name {
    font-size: 1.2rem; font-weight: 700;
}
.profile-username {
    font-size: 0.8rem; color: var(--text-muted);
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px; margin: 16px 0;
}

.profile-menu { margin-top: 20px; }
.profile-menu-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    cursor: pointer;
}
.profile-menu-item:hover { background: var(--bg-card-hover); }
.profile-menu-item i {
    width: 20px; text-align: center;
    color: var(--primary-light);
}
.profile-menu-item .arrow {
    margin-left: auto; color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Payment Modal ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-overlay);
    z-index: 2000;
    display: none; align-items: flex-end;
    animation: fadeIn 0.3s ease;
}
.modal-overlay.show { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    width: 100%;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px;
    overflow-y: auto;
    animation: slideUp 0.35s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-handle {
    width: 40px; height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 0 auto 16px;
}

.modal-title {
    font-size: 1.1rem; font-weight: 700;
    margin-bottom: 16px;
}

/* ===== Form Elements ===== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-input {
    width: 100%; height: 48px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-textarea {
    width: 100%; min-height: 100px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.file-upload {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}
.file-upload:hover { border-color: var(--primary); background: rgba(108,92,231,0.05); }
.file-upload i {
    font-size: 2rem; color: var(--primary-light);
    margin-bottom: 8px;
}
.file-upload-text {
    font-size: 0.85rem; color: var(--text-secondary);
}

/* ===== Notification Items ===== */
.notif-item {
    display: flex; gap: 12px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: all 0.3s ease;
}
.notif-item.unread {
    border-left: 3px solid var(--primary);
    background: rgba(108,92,231,0.05);
}
.notif-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    background: var(--primary-glow);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.notif-body { flex: 1; }
.notif-title { font-size: 0.85rem; font-weight: 600; }
.notif-text { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }
.notif-time { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; }

/* ===== Language Switcher (was .lang-switcher) ===== */
.lang-dropdown-wrapper {
    position: relative;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 140px;
    overflow: hidden;
    z-index: 500;
    animation: fadeIn 0.2s ease;
}
.lang-dropdown.show { display: block; }

.lang-dropdown-item {
    display: block;
    width: 100%;
    padding: 11px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    background: none;
    text-align: left;
    border-radius: 0;
    transition: background 0.2s ease;
}
.lang-dropdown-item:hover {
    background: var(--bg-card-hover);
}
.lang-dropdown-item.active {
    background: var(--primary-glow);
    color: var(--primary-light);
    font-weight: 700;
}

/* Legacy lang-btn used in lang-switcher row (profile etc.) */
.lang-btn {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600;
    background: none; color: var(--text-muted);
    transition: all 0.3s ease;
}
.lang-btn.active {
    background: var(--gradient-primary);
    color: #fff;
}

/* Overlay that closes dropdown when clicking outside */
.helper-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
}
.helper-overlay.show { display: block; }


/* ===== Loading ===== */
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed; top: 70px; left: 16px; right: 16px;
    z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem; font-weight: 500;
    animation: toastIn 0.3s ease;
    display: flex; align-items: center; gap: 10px;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Leaderboard ===== */
.leaderboard-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}
.leaderboard-rank {
    font-size: 1rem; font-weight: 800;
    width: 30px; text-align: center;
    color: var(--text-muted);
}
.leaderboard-item:nth-child(1) .leaderboard-rank { color: #FFD700; }
.leaderboard-item:nth-child(2) .leaderboard-rank { color: #C0C0C0; }
.leaderboard-item:nth-child(3) .leaderboard-rank { color: #CD7F32; }

.leaderboard-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.leaderboard-info { flex: 1; }
.leaderboard-name { font-size: 0.85rem; font-weight: 600; }
.leaderboard-points {
    font-size: 0.75rem; color: var(--primary-light);
}

/* ===== Badge Grid ===== */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.badge-item {
    text-align: center;
    padding: 14px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.badge-icon { font-size: 2rem; margin-bottom: 6px; }
.badge-name { font-size: 0.7rem; font-weight: 600; color: var(--text-secondary); }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (min-width: 480px) {
    .courses-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
    .courses-grid { grid-template-columns: repeat(4, 1fr); }
    .featured-card { width: 320px; }
}
