/* ====================================
   SADAF KURS — Youth Design (14-30 yosh)
   Glassmorphism + Gradient + Modern
   ==================================== */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;
    --accent: #7c3aed;
    --accent-light: rgba(124, 58, 237, 0.15);
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.15);
    --warning: #f97316;
    --warning-light: rgba(249, 115, 22, 0.15);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --info: #06b6d4;
    --info-light: rgba(6, 182, 212, 0.15);
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.3);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-full: 50%;
    --glass: backdrop-filter: blur(12px);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(236, 72, 153, 0.06) 0%, transparent 50%);
}

/* ====== SCREENS ====== */
.screen { display: none; width: 100%; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ====== LOADING ====== */
#loading-screen { justify-content: center; align-items: center; }
.loading-container { text-align: center; }
.logo-animation { width: 100px; height: 100px; margin: 0 auto 20px; }
.logo-svg { width: 100%; height: 100%; }
.loading-text { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; letter-spacing: 1px; }
.loading-bar { width: 140px; height: 3px; background: var(--bg-secondary); border-radius: 3px; margin: 0 auto; overflow: hidden; }
.loading-bar-fill { width: 0%; height: 100%; background: var(--accent-gradient); border-radius: 3px; animation: loadingProgress 2s ease-in-out forwards; }

/* ====== SUBSCRIPTION SCREEN ====== */
.subscription-container {
    padding: 40px 24px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.sub-icon { width: 80px; height: 80px; margin: 0 auto 24px; }
.sub-svg { width: 100%; height: 100%; }
.subscription-container h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.subscription-container p { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }

.channels-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.channel-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}
.channel-item:active { transform: scale(0.97); background: rgba(255,255,255,0.1); }
.channel-status { width: 28px; height: 28px; flex-shrink: 0; }
.channel-item .channel-name { flex: 1; font-size: 15px; font-weight: 500; }

/* ====== HEADER ====== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(15, 15, 26, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar {
    width: 42px; height: 42px;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 2px solid var(--accent);
    padding: 2px;
    background: var(--accent-gradient);
}
.user-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-placeholder { width: 100%; height: 100%; }
.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 15px; font-weight: 600; }
.user-level { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent); }
.level-icon { width: 12px; height: 12px; }

.points-badge {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    background: var(--accent-light);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 24px;
    font-weight: 700; font-size: 14px;
    color: #c4b5fd;
}
.points-icon { width: 16px; height: 16px; }

/* ====== QUICK STATS ====== */
.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 20px; }
.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--accent-gradient);
    opacity: 0.6;
}
.stat-card:active { transform: scale(0.95); }
.stat-icon { width: 22px; height: 22px; margin: 0 auto 8px; }
.stat-value { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.stat-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ====== CONTENT ====== */
.content-area { flex: 1; padding: 20px; padding-bottom: 90px; overflow-y: auto; }

/* ====== COURSE CARDS ====== */
.course-grid { display: flex; flex-direction: column; gap: 14px; }
.course-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}
.course-card:nth-child(1) { animation-delay: 0.05s; }
.course-card:nth-child(2) { animation-delay: 0.1s; }
.course-card:nth-child(3) { animation-delay: 0.15s; }
.course-card:nth-child(4) { animation-delay: 0.2s; }
.course-card:active { transform: scale(0.97); border-color: rgba(124,58,237,0.4); }
.course-card::after {
    content: '';
    position: absolute; top: -50%; right: -50%;
    width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(124,58,237,0.06) 0%, transparent 70%);
    pointer-events: none;
}
.course-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.course-category {
    font-size: 10px; color: var(--accent); font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    padding: 3px 8px;
    background: var(--accent-light);
    border-radius: 6px;
}
.course-lock { width: 18px; height: 18px; opacity: 0.5; }
.course-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.course-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.course-progress { display: flex; align-items: center; gap: 12px; }
.progress-bar { flex: 1; height: 5px; background: rgba(255,255,255,0.06); border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-gradient); border-radius: 5px; transition: width 0.8s ease; }
.progress-text { font-size: 12px; font-weight: 700; color: var(--text-secondary); min-width: 35px; text-align: right; }

/* ====== QUEST LIST ====== */
.quest-list { display: flex; flex-direction: column; gap: 10px; }
.quest-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}
.quest-item.completed { opacity: 0.5; }
.quest-item.locked { opacity: 0.3; pointer-events: none; }
.quest-item:active { transform: scale(0.97); }
.quest-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--accent-light);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.quest-icon svg { width: 20px; height: 20px; }
.quest-info { flex: 1; }
.quest-title { font-size: 14px; font-weight: 600; }
.quest-reward { font-size: 12px; color: var(--accent); font-weight: 700; margin-top: 2px; }
.quest-status { width: 24px; height: 24px; }

/* ====== REFERRAL ====== */
.referral-section { text-align: center; padding: 24px 0; }
.referral-progress-ring { width: 160px; height: 160px; margin: 0 auto 24px; position: relative; }
.referral-progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.referral-progress-ring .ring-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 8; }
.referral-progress-ring .ring-fill { fill: none; stroke: url(#gradient); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.referral-center-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.referral-center-text .big-number { font-size: 32px; font-weight: 800; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.referral-center-text .small-text { font-size: 12px; color: var(--text-muted); }

.referral-link-box {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex; align-items: center; gap: 10px;
    margin: 20px 0;
}
.referral-link-box input { flex: 1; border: none; background: transparent; font-size: 12px; color: var(--text-secondary); outline: none; font-family: monospace; }
.copy-btn {
    background: var(--accent-gradient);
    color: white; border: none; border-radius: 8px;
    padding: 8px 14px; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.copy-btn:active { transform: scale(0.9); }

/* ====== PROFILE ====== */
.profile-section { text-align: center; padding-top: 24px; }
.profile-avatar-large {
    width: 90px; height: 90px;
    border-radius: var(--radius-full);
    margin: 0 auto 14px;
    overflow: hidden;
    padding: 3px;
    background: var(--accent-gradient);
}
.profile-avatar-large img, .profile-avatar-large svg { width: 100%; height: 100%; border-radius: 50%; }
.profile-name { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.profile-level-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 14px;
    background: var(--accent-light);
    border: 1px solid rgba(124,58,237,0.3);
    border-radius: 20px;
    font-size: 12px; font-weight: 600; color: #c4b5fd;
    margin-bottom: 24px;
}
.profile-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 24px; }
.profile-stat {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    padding: 16px; border-radius: var(--radius-sm);
}
.profile-stat-value { font-size: 22px; font-weight: 800; }
.profile-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.badges-section { text-align: left; margin-top: 24px; }
.badges-section h3 { font-size: 16px; margin-bottom: 14px; font-weight: 700; }
.badges-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.badge-item { text-align: center; }
.badge-icon {
    width: 48px; height: 48px; margin: 0 auto 6px;
    background: var(--bg-glass); border: 1px solid var(--border);
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.badge-icon.earned { background: var(--accent-light); border-color: rgba(124,58,237,0.4); box-shadow: var(--shadow-glow); }
.badge-icon svg { width: 24px; height: 24px; }
.badge-name { font-size: 10px; color: var(--text-muted); }

/* ====== BOTTOM NAV ====== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex;
    background: rgba(15, 15, 26, 0.9);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 8px 4px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 200;
}
.nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 3px;
    padding: 8px 4px;
    background: none; border: none;
    color: var(--text-muted);
    font-size: 10px; cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.nav-item.active { color: var(--accent); }
.nav-item.active .nav-icon { filter: drop-shadow(0 0 6px rgba(124,58,237,0.5)); }
.nav-item.active::after {
    content: '';
    position: absolute; bottom: -8px;
    width: 20px; height: 3px;
    background: var(--accent-gradient);
    border-radius: 3px 3px 0 0;
}
.nav-icon { width: 22px; height: 22px; }

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 24px; border: none;
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: var(--accent-gradient); color: white; box-shadow: 0 4px 15px rgba(124,58,237,0.3); }
.btn-secondary { background: var(--bg-glass); color: var(--text-primary); border: 1px solid var(--border); }
.btn-full { width: 100%; }
.btn-icon { width: 18px; height: 18px; }

/* ====== TOAST ====== */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    display: flex; align-items: center; gap: 10px;
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-size: 14px;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.hidden { transform: translateX(-50%) translateY(-100px); }
.toast-icon { width: 20px; height: 20px; }

/* ====== ACHIEVEMENT POPUP ====== */
.achievement-popup {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000; padding: 24px;
}
.achievement-popup.hidden { display: none; }
.achievement-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 28px;
    text-align: center;
    max-width: 300px; width: 100%;
    animation: scaleIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.achievement-icon { width: 72px; height: 72px; margin: 0 auto 18px; }
.achievement-title { font-size: 20px; margin-bottom: 8px; font-weight: 700; }
.achievement-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }

/* ====== SECTION ====== */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-title { font-size: 18px; font-weight: 800; }
.section-link { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 600; }

/* ====== EMPTY STATE ====== */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { color: var(--text-muted); font-size: 14px; }

/* ====== LEADERBOARD ====== */
.leaderboard-list { display: flex; flex-direction: column; gap: 8px; }
.leaderboard-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    background: var(--bg-glass); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.leaderboard-rank { width: 28px; text-align: center; font-weight: 800; font-size: 14px; color: var(--text-muted); }
.leaderboard-rank.top-1 { color: #fbbf24; }
.leaderboard-rank.top-2 { color: #9ca3af; }
.leaderboard-rank.top-3 { color: #d97706; }
.leaderboard-name { flex: 1; font-size: 14px; font-weight: 500; }
.leaderboard-points { font-size: 14px; font-weight: 800; color: var(--accent); }

/* ====== LESSON ====== */
.lesson-content { line-height: 1.8; font-size: 15px; color: var(--text-secondary); }
.lesson-content h1, .lesson-content h2, .lesson-content h3 { margin-top: 20px; margin-bottom: 10px; color: var(--text-primary); }
.lesson-content p { margin-bottom: 12px; }
.lesson-content code { background: var(--bg-glass); padding: 2px 8px; border-radius: 6px; font-size: 13px; color: #c4b5fd; }
.lesson-content pre { background: var(--bg-secondary); padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; margin-bottom: 16px; border: 1px solid var(--border); }
.video-wrapper { width: 100%; aspect-ratio: 16/9; background: var(--bg-secondary); border-radius: var(--radius-sm); margin-bottom: 16px; overflow: hidden; border: 1px solid var(--border); }
.video-wrapper iframe { width: 100%; height: 100%; border: none; }

/* ====== REFERRAL LIST ====== */
.referral-list { margin-top: 24px; text-align: left; }
.referral-list-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.referral-list-item .ref-name { flex: 1; font-size: 14px; }
.referral-list-item .ref-status { width: 20px; height: 20px; }

/* ====== SKELETON ====== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-glass) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
.skeleton-card { height: 110px; margin-bottom: 14px; }

/* ====== SPINNER ====== */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner-small { width: 16px; height: 16px; border-width: 2px; }

/* ====== CONFETTI ====== */
.confetti-particle {
    position: fixed; width: 8px; height: 8px; border-radius: 2px;
    animation: confetti 1.5s ease forwards;
    pointer-events: none; z-index: 9999;
}

/* ====== POINTS ANIM ====== */
.points-anim {
    position: fixed; font-size: 20px; font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    pointer-events: none;
    animation: pointsUp 1.5s ease forwards;
    z-index: 9999;
}

/* ====== PAGE TRANSITION ====== */
.page-enter { animation: fadeInUp 0.3s ease forwards; }

/* ====== NOTIF DOT ====== */
.notif-dot { width: 8px; height: 8px; background: var(--danger); border-radius: 50%; position: absolute; top: 4px; right: 4px; animation: pulse 1.5s ease infinite; }
