/* ══════════════════════════════════════════════════════════════════════════════
   UPSC Course Store — Classplus-Style Design
   Clean, Minimal, Professional Indian EdTech UI
   ══════════════════════════════════════════════════════════════════════════════ */

:root {
    --bg: #F5F5F5;
    --surface: #FFFFFF;
    --text: #1A1A2E;
    --text-light: #666666;
    --text-muted: #999999;
    --accent: #4A6CF7;
    --accent-hover: #3B5DE7;
    --accent-bg: #EEF1FF;
    --green: #34C759;
    --green-bg: #E8F9ED;
    --orange: #FF9500;
    --red: #FF3B30;
    --border: #E8E8E8;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --r: 12px;
    --r-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg); color: var(--text);
    min-height: 100vh; padding-bottom: 68px;
    -webkit-font-smoothing: antialiased;
}

/* ── AUTH SCREENS (Classplus-style) ────────────────────────────────────────── */
.auth-screen {
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
    background: #F5F5F5; z-index: 500; padding: 20px;
}
.auth-card {
    background: #fff; border-radius: 16px; padding: 36px 28px;
    width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); text-align: center;
}
.auth-illustration {
    font-size: 56px; margin-bottom: 16px;
    width: 90px; height: 90px; line-height: 90px;
    background: var(--accent-bg); border-radius: 50%;
    display: inline-block;
}
.auth-title {
    font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 8px;
}
.auth-desc {
    font-size: 14px; color: var(--text-light); line-height: 1.6; margin-bottom: 24px;
}
.auth-desc strong { color: var(--text); font-weight: 700; }

.input-group { text-align: left; margin-bottom: 20px; }
.input-label {
    font-size: 12px; font-weight: 700; color: var(--text-light);
    text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; display: block;
}
.input-row {
    display: flex; align-items: center; border: 1.5px solid var(--border);
    border-radius: var(--r); overflow: hidden; transition: border-color 0.2s;
}
.input-row:focus-within { border-color: var(--accent); }
.country-code {
    padding: 14px 12px 14px 16px; font-size: 15px; font-weight: 600;
    color: var(--text); white-space: nowrap; border-right: 1.5px solid var(--border);
    background: #FAFAFA;
}
.text-input {
    flex: 1; border: none; outline: none; padding: 14px 16px;
    font-size: 16px; font-weight: 600; color: var(--text);
    font-family: inherit; background: transparent; letter-spacing: 1px;
}
.text-input::placeholder { color: var(--text-muted); font-weight: 400; letter-spacing: 0; }

/* OTP Boxes */
.otp-boxes { display: flex; gap: 8px; justify-content: center; }
.otp-box {
    width: 46px; height: 54px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
    text-align: center; font-size: 22px; font-weight: 800; color: var(--text);
    outline: none; font-family: inherit; background: #FAFAFA; transition: all 0.15s;
}
.otp-box:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(74,108,247,0.1); }

.primary-btn {
    width: 100%; padding: 15px; border: none; border-radius: var(--r);
    background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
    letter-spacing: 0.3px;
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-footer {
    font-size: 12px; color: var(--text-muted); margin-top: 20px; line-height: 1.5;
}

.otp-actions {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 20px; font-size: 13px; color: var(--text-light);
}
.resend-text { font-size: 13px; color: var(--text-muted); }
.link-text { color: var(--accent); font-weight: 600; cursor: pointer; }
.link-text:hover { text-decoration: underline; }

/* ── HEADER ────────────────────────────────────────────────────────────────── */
.app-header {
    background: #fff; padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.app-header h1 { font-size: 20px; font-weight: 800; color: var(--text); }
.app-header .subtitle { font-size: 13px; color: var(--text-light); margin-top: 2px; }
.app-header.with-back { display: flex; align-items: center; gap: 10px; }
.back-btn {
    background: none; border: none; color: var(--accent); font-size: 15px;
    font-weight: 600; cursor: pointer; padding: 8px 4px;
}

/* ── COURSE CARDS ──────────────────────────────────────────────────────────── */
.course-grid { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.course-card {
    display: flex; background: #fff; border-radius: var(--r);
    overflow: hidden; cursor: pointer; transition: all 0.15s;
    box-shadow: var(--shadow); border: 1px solid var(--border);
}
.course-card:active { transform: scale(0.985); }
.course-stripe { width: 5px; flex-shrink: 0; }
.course-info { flex: 1; padding: 14px 16px; }
.course-title { font-size: 15px; font-weight: 700; line-height: 1.35; margin-bottom: 5px; }
.course-desc {
    font-size: 12.5px; color: var(--text-light); line-height: 1.45; margin-bottom: 10px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.course-footer { display: flex; align-items: center; justify-content: space-between; }
.course-price { font-size: 17px; font-weight: 800; color: var(--accent); }
.course-tag {
    font-size: 12px; color: var(--accent); font-weight: 600; background: var(--accent-bg);
    padding: 4px 10px; border-radius: 20px;
}
.price-block { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.original-price {
    font-size: 13px; color: var(--text-muted); text-decoration: line-through; font-weight: 500;
}
.discount-badge {
    font-size: 11px; font-weight: 800; color: #fff; background: #FF3B30;
    padding: 3px 8px; border-radius: 4px; white-space: nowrap;
}

/* ── COURSE DETAIL ─────────────────────────────────────────────────────────── */
.course-detail { padding: 0 16px 100px; }
.detail-hero {
    text-align: center; padding: 28px 16px 24px;
    background: linear-gradient(160deg, #4A6CF7, #3B5DE7);
    margin: 0 -16px; border-radius: 0 0 20px 20px;
}
.detail-emoji {
    font-size: 48px; width: 80px; height: 80px; line-height: 80px;
    background: rgba(255,255,255,0.15); border-radius: 20px; display: inline-block; margin-bottom: 12px;
}
.detail-title { font-size: 20px; font-weight: 800; color: #fff; line-height: 1.3; margin-bottom: 8px; }
.detail-price { font-size: 28px; font-weight: 900; color: #fff; }
.detail-badge {
    display: inline-block; margin-top: 10px; padding: 5px 14px;
    background: rgba(255,255,255,0.18); border-radius: 20px;
    font-size: 12px; font-weight: 600; color: #fff;
}
.detail-body {
    background: #fff; border-radius: var(--r); padding: 18px;
    margin-top: 14px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.detail-body h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.detail-desc { font-size: 13.5px; color: var(--text-light); line-height: 1.7; }
.detail-features { display: flex; flex-direction: column; gap: 12px; }
.feature { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; }
.feature-icon {
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    font-size: 16px; background: var(--accent-bg); border-radius: var(--r-sm); flex-shrink: 0;
}

/* ── BUY BAR ───────────────────────────────────────────────────────────────── */
.buy-bar {
    position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: #fff; border-top: 1px solid var(--border); z-index: 200;
    display: flex; box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}
.buy-btn {
    width: 100%; padding: 15px; border: none; border-radius: var(--r);
    background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.buy-btn:active { transform: scale(0.98); }
.buy-btn.purchased { background: var(--green); }
.buy-btn:disabled { opacity: 0.5; }

/* ── MY COURSES ────────────────────────────────────────────────────────────── */
.my-courses-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.my-course-card {
    display: flex; align-items: center; background: #fff; border-radius: var(--r);
    padding: 14px 16px; gap: 14px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.my-course-emoji {
    font-size: 24px; width: 48px; height: 48px; display: flex; align-items: center;
    justify-content: center; background: var(--green-bg); border-radius: var(--r-sm); flex-shrink: 0;
}
.my-course-info { flex: 1; min-width: 0; }
.my-course-title {
    font-size: 14px; font-weight: 700; margin-bottom: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.my-course-meta { font-size: 12px; color: var(--text-muted); }
.my-course-access {
    background: var(--accent); color: #fff; text-decoration: none;
    padding: 8px 14px; border-radius: var(--r-sm);
    font-size: 12px; font-weight: 700; white-space: nowrap;
}

/* ── LOADING / EMPTY ───────────────────────────────────────────────────────── */
.loading { text-align: center; padding: 60px 20px; color: var(--text-light); }
.spinner {
    width: 32px; height: 32px; border: 3px solid var(--border);
    border-top: 3px solid var(--accent); border-radius: 50%;
    animation: spin 0.7s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 60px 20px; }
.empty-emoji { font-size: 48px; margin-bottom: 14px; }
.empty-state h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: var(--text-light); }
.error-state { color: var(--red); text-align: center; padding: 60px 20px; }

/* ── BOTTOM NAV ────────────────────────────────────────────────────────────── */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; display: flex;
    background: #fff; border-top: 1px solid var(--border); padding: 6px 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 100;
}
.nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 2px; text-decoration: none; color: var(--text-muted); font-size: 10px; padding: 4px;
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 22px; }
.nav-label { font-weight: 700; }

/* ── MODAL ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px; backdrop-filter: blur(4px);
}
.modal-content {
    background: #fff; border-radius: 16px; padding: 32px 24px; text-align: center;
    max-width: 320px; width: 100%; animation: modalPop 0.2s ease; box-shadow: var(--shadow-lg);
}
@keyframes modalPop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-emoji { font-size: 52px; margin-bottom: 14px; }
.modal-content h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.modal-content p { font-size: 13.5px; color: var(--text-light); margin-bottom: 20px; line-height: 1.5; }
.modal-btn {
    display: block; width: 100%; padding: 14px; border: none; border-radius: var(--r);
    background: var(--accent); color: #fff; font-size: 15px; font-weight: 700;
    text-decoration: none; text-align: center; cursor: pointer; margin-bottom: 8px; font-family: inherit;
}
.modal-btn.secondary { background: var(--bg); color: var(--text); }

/* ── TOAST ─────────────────────────────────────────────────────────────────── */
.alert-toast {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
    background: #333; color: #fff; padding: 12px 24px; border-radius: var(--r);
    font-size: 13px; font-weight: 600; z-index: 2000; animation: slideDown 0.2s ease;
    box-shadow: var(--shadow-lg); max-width: 90%;
}
@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-16px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
