/* ── AV MentorAI — Main Styles ── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold: #facc15;
  --gold-dim: rgba(250,204,21,.15);
  --gold-border: rgba(250,204,21,.35);
  --sky: #38bdf8;
  --purple: #a855f7;
  --green: #22c55e;
  --orange: #f97316;
  --red: #ef4444;
  --bg: #020617;
  --bg2: #0b1120;
  --bg3: #1e293b;
  --surface: rgba(15,23,42,.88);
  --surface2: rgba(15,23,42,.95);
  --border: rgba(148,163,184,.2);
  --text: #f8fafc;
  --text2: #cbd5e1;
  --text3: #94a3b8;
  --text4: #64748b;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --font-display: 'Syne', sans-serif;
  --font-body: 'Inter', sans-serif;
  --sidebar-w: 220px;
  --header-h: 0px;
}

html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: radial-gradient(circle at top left, #1f2937 0%, #0b1120 45%, #020617 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(250,204,21,.3); border-radius: 3px; }

/* ── UTILITY ── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.text-gold { color: var(--gold) !important; }
.text-sky { color: var(--sky) !important; }
.text-purple { color: var(--purple) !important; }
.text-green { color: var(--green) !important; }
.text-muted { color: var(--text3); font-size: 13px; }
.fw-800 { font-weight: 800; }
.font-display { font-family: var(--font-display); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-gold { border-color: var(--gold-border); background: linear-gradient(135deg, rgba(250,204,21,.1), rgba(56,189,248,.06)); }
.card-purple { border-color: rgba(168,85,247,.35); background: linear-gradient(135deg, rgba(168,85,247,.1), rgba(99,102,241,.06)); }
.card-green { border-color: rgba(34,197,94,.35); background: linear-gradient(135deg, rgba(34,197,94,.1), rgba(16,185,129,.06)); }
.card-blue { border-color: rgba(56,189,248,.35); background: linear-gradient(135deg, rgba(56,189,248,.1), rgba(99,102,241,.06)); }
.card-orange { border-color: rgba(249,115,22,.35); background: linear-gradient(135deg, rgba(249,115,22,.1), rgba(239,68,68,.06)); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px; font-weight: 700;
  cursor: pointer; border: none; transition: all .2s; text-decoration: none;
  white-space: nowrap; user-select: none;
}
.btn-primary {
  background: linear-gradient(90deg, var(--gold), var(--orange));
  color: #111827;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--gold-border);
  color: var(--text2);
}
.btn-ghost:hover { background: var(--gold-dim); color: var(--gold); }
.btn-sky { background: linear-gradient(90deg, #0ea5e9, #0284c7); color: #fff; }
.btn-purple { background: linear-gradient(90deg, #a855f7, #7c3aed); color: #fff; }
.btn-green { background: linear-gradient(90deg, #22c55e, #16a34a); color: #fff; }
.btn-red { background: linear-gradient(90deg, #ef4444, #dc2626); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── INPUTS ── */
.input, .textarea, .select {
  width: 100%; padding: 10px 14px;
  background: #0f172a; color: var(--text);
  border: 1px solid rgba(250,204,21,.3); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px;
  transition: border-color .2s; outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--gold); }
.input::placeholder, .textarea::placeholder { color: var(--text4); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.select option { background: #0f172a; }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--text3); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .5px; }

/* ── CHAT ── */
.chat-wrap { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.chat-msg { padding: 14px 16px; border-radius: var(--radius); line-height: 1.65; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.chat-msg-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.chat-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.chat-name { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.msg-user { background: rgba(30,41,59,.95); border-left: 3px solid var(--gold); }
.msg-user .chat-avatar { background: linear-gradient(135deg, var(--gold), var(--orange)); }
.msg-user .chat-name { color: var(--gold); }
.msg-ai { background: var(--surface2); border-left: 3px solid var(--sky); }
.msg-ai .chat-avatar { background: linear-gradient(135deg, var(--sky), #6366f1); }
.msg-ai .chat-name { color: var(--sky); }
.msg-english { background: var(--surface2); border-left: 3px solid var(--purple); }
.msg-english .chat-avatar { background: linear-gradient(135deg, var(--purple), #6366f1); }
.msg-english .chat-name { color: var(--purple); }
.msg-mate { background: var(--surface2); border-left: 3px solid var(--green); }
.msg-mate .chat-avatar { background: linear-gradient(135deg, var(--green), #16a34a); }
.msg-mate .chat-name { color: var(--green); }
.chat-input-wrap { position: sticky; bottom: 0; background: linear-gradient(to top, #020617 60%, transparent); padding: 12px 0 4px; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; background: #1e293b; border: 2px solid var(--gold); border-radius: var(--radius); padding: 6px 10px; }
.chat-input-row textarea { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--font-body); font-size: 14px; resize: none; max-height: 120px; padding: 4px; line-height: 1.5; }
.chat-input-row textarea::placeholder { color: rgba(250,204,21,.7); font-size: 13px; }
.chat-send-btn { background: linear-gradient(90deg, var(--gold), var(--orange)); border: none; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 16px; flex-shrink: 0; transition: opacity .2s; }
.chat-send-btn:hover { opacity: .85; }
.typing-indicator { display: flex; align-items: center; gap: 4px; padding: 12px 16px; }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sky); animation: typingBounce 1.2s infinite; }
.typing-dot:nth-child(2) { animation-delay: .2s; background: var(--purple); }
.typing-dot:nth-child(3) { animation-delay: .4s; background: var(--gold); }
@keyframes typingBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* ── PROGRESS ── */
.progress-bar { height: 10px; background: rgba(148,163,184,.15); border-radius: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); border-radius: 8px; transition: width .4s ease; }

/* ── BADGE ── */
.badge { display: inline-block; padding: 4px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.badge-gold { background: linear-gradient(90deg, var(--gold), var(--orange)); color: #111; }
.badge-sky { background: rgba(56,189,248,.2); color: var(--sky); border: 1px solid rgba(56,189,248,.3); }
.badge-purple { background: rgba(168,85,247,.2); color: var(--purple); border: 1px solid rgba(168,85,247,.3); }
.badge-green { background: rgba(34,197,94,.2); color: var(--green); border: 1px solid rgba(34,197,94,.3); }

/* ── TABS ── */
.tab-bar { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 18px; }
.tab-btn { padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; color: var(--text3); background: transparent; transition: all .2s; white-space: nowrap; }
.tab-btn:hover { color: var(--text2); background: var(--gold-dim); }
.tab-btn.active { background: rgba(250,204,21,.15); border-color: var(--gold); color: var(--gold); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── SUBNAV RADIO ── */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.subnav-btn { padding: 6px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); color: var(--text3); background: var(--surface); transition: all .2s; }
.subnav-btn:hover { border-color: var(--gold-border); color: var(--text2); }
.subnav-btn.active { background: rgba(250,204,21,.15); border-color: var(--gold); color: var(--gold); }

/* ── LESSON CARD ── */
.lesson-card { background: var(--surface); border: 1px solid rgba(56,189,248,.2); border-radius: var(--radius); padding: 13px 16px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.lesson-card.done { border-color: rgba(34,197,94,.4); }
.lesson-title { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.lesson-desc { font-size: 12px; color: var(--text3); }
.lesson-content-box { background: var(--surface2); border: 1px solid rgba(56,189,248,.25); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; line-height: 1.75; white-space: pre-wrap; font-size: 14px; }
.quiz-card { background: var(--surface2); border: 1px solid rgba(250,204,21,.25); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.quiz-option { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-top: 6px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; transition: all .15s; }
.quiz-option:hover { background: rgba(250,204,21,.08); border-color: var(--gold-border); }
.quiz-option input { accent-color: var(--gold); }

/* ── METRIC CHIP ── */
.metric-chip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.metric-val { font-size: 22px; font-weight: 800; font-family: var(--font-display); }
.metric-lbl { font-size: 11px; color: var(--text3); margin-top: 2px; text-transform: uppercase; letter-spacing: .5px; }

/* ── ALERT ── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 12px; }
.alert-success { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.4); color: #86efac; }
.alert-warning { background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.4); color: #fde68a; }
.alert-error { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4); color: #fca5a5; }
.alert-info { background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.3); color: #bae6fd; }

/* ── TOAST ── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: toastIn .3s ease; max-width: 320px; }
.toast-success { background: #14532d; border: 1px solid var(--green); color: #86efac; }
.toast-error { background: #450a0a; border: 1px solid var(--red); color: #fca5a5; }
.toast-info { background: #0c4a6e; border: 1px solid var(--sky); color: #bae6fd; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ── SPINNER ── */
.spinner { width: 22px; height: 22px; border: 2px solid rgba(250,204,21,.3); border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { display: flex; align-items: center; gap: 10px; color: var(--text3); font-size: 13px; padding: 12px 0; }

/* ── HEADER / HERO ── */
.hero-card { background: linear-gradient(135deg, rgba(250,204,21,.14), rgba(56,189,248,.08)); border: 1px solid var(--gold-border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 20px; }
.av-logo { font-family: var(--font-display); font-size: 36px; font-weight: 900; background: linear-gradient(90deg, var(--gold), var(--orange), var(--sky)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.1; }
.av-subtitle { font-size: 14px; color: var(--text2); margin-top: 4px; }

/* ── SIDEBAR ── */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, #020617 0%, #0b1120 100%);
  border-right: 1px solid rgba(250,204,21,.18);
  z-index: 200; padding: 16px 10px; overflow-y: auto;
  transition: transform .3s ease;
  display: flex; flex-direction: column; gap: 2px;
}
#sidebar.hidden-mobile { transform: translateX(-100%); }
.sidebar-logo { font-family: var(--font-display); font-size: 22px; font-weight: 900; background: linear-gradient(90deg, var(--gold), var(--orange)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; padding: 4px 10px 14px; }
.nav-section { font-size: 10px; font-weight: 700; color: var(--text4); text-transform: uppercase; letter-spacing: 1px; padding: 10px 10px 4px; }
.nav-btn { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text2); border: none; background: transparent; width: 100%; text-align: left; transition: all .18s; margin-bottom: 2px; }
.nav-btn:hover { background: rgba(250,204,21,.08); color: var(--text); }
.nav-btn.active { background: rgba(250,204,21,.14); color: var(--gold); border-left: 3px solid var(--gold); }
.nav-btn .nav-icon { font-size: 17px; flex-shrink: 0; }
#hamburger { display: none; position: fixed; top: 14px; left: 14px; z-index: 300; background: rgba(250,204,21,.15); border: 1px solid var(--gold-border); border-radius: 10px; padding: 8px; cursor: pointer; font-size: 20px; }
#overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 199; }
#main-content { margin-left: var(--sidebar-w); padding: 24px 28px; max-width: 900px; }

/* ── QUICK BUTTONS ── */
.quick-btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.qbtn { padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text2); transition: all .2s; text-align: center; }
.qbtn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.qbtn-gold { border-color: rgba(250,204,21,.4); } .qbtn-gold:hover { background: linear-gradient(90deg, #f59e0b, #d97706); color: #111; }
.qbtn-green { border-color: rgba(34,197,94,.4); } .qbtn-green:hover { background: linear-gradient(90deg, #10b981, #059669); color: #fff; }
.qbtn-indigo { border-color: rgba(99,102,241,.4); } .qbtn-indigo:hover { background: linear-gradient(90deg, #6366f1, #4f46e5); color: #fff; }
.qbtn-red { border-color: rgba(239,68,68,.4); } .qbtn-red:hover { background: linear-gradient(90deg, #ef4444, #dc2626); color: #fff; }
.qbtn-purple { border-color: rgba(168,85,247,.4); } .qbtn-purple:hover { background: linear-gradient(90deg, #8b5cf6, #7c3aed); color: #fff; }
.qbtn-sky { border-color: rgba(56,189,248,.4); } .qbtn-sky:hover { background: linear-gradient(90deg, #0ea5e9, #0284c7); color: #fff; }

/* ── CHALLENGE CARD ── */
.challenge-card { background: linear-gradient(135deg, rgba(249,115,22,.14), rgba(250,204,21,.08)); border: 1px solid rgba(250,204,21,.4); border-radius: var(--radius-lg); padding: 18px; }

/* ── RANKING TABLE ── */
.rank-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rank-table th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
.rank-table td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.04); }
.rank-table tr:hover td { background: rgba(250,204,21,.04); }
.rank-num { font-weight: 800; color: var(--gold); font-family: var(--font-display); }

/* ── ONBOARDING ── */
#onboarding { position: fixed; inset: 0; background: radial-gradient(circle at top left, #1f2937, #020617); z-index: 1000; overflow-y: auto; padding: 40px 20px; display: flex; align-items: flex-start; justify-content: center; }
.onboarding-inner { max-width: 540px; width: 100%; }

/* ── LOGIN ── */
#login-screen { position: fixed; inset: 0; background: radial-gradient(circle at top left, #1f2937 0%, #0b1120 45%, #020617 100%); z-index: 1000; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 40px 20px; }
.login-box { max-width: 420px; width: 100%; }
.login-tabs { display: flex; gap: 0; margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.login-tab { flex: 1; padding: 10px; text-align: center; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; color: var(--text3); background: transparent; border: none; }
.login-tab.active { background: rgba(250,204,21,.15); color: var(--gold); }

/* ── FEATURE GRID ── */
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.feature-item { border-radius: var(--radius); padding: 12px 14px; font-size: 13px; }
.feature-item b { font-size: 14px; display: block; margin-bottom: 4px; }
.feature-item span { color: var(--text2); font-size: 12px; line-height: 1.5; }

/* ── STATS ROW ── */
.stats-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.stat-pill { background: rgba(250,204,21,.1); border: 1px solid rgba(250,204,21,.25); border-radius: 12px; padding: 8px 14px; text-align: center; flex: 1; min-width: 70px; }
.stat-pill .sv { font-size: 18px; font-weight: 800; color: var(--gold); display: block; font-family: var(--font-display); }
.stat-pill .sl { font-size: 11px; color: var(--text3); }

/* ── PLAN CARD ── */
.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; text-align: center; }
.plan-card h2 { font-family: var(--font-display); font-size: 22px; margin-bottom: 14px; }
.plan-card p { font-size: 13px; color: var(--text2); margin: 6px 0; }
.plan-price { font-size: 32px; font-weight: 900; font-family: var(--font-display); color: var(--gold); margin: 14px 0; }
.plan-card.featured { border-color: var(--gold); background: linear-gradient(135deg, rgba(250,204,21,.1), rgba(249,115,22,.06)); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  #sidebar { transform: translateX(-100%); width: 240px; }
  #sidebar.open { transform: translateX(0); }
  #hamburger { display: block; }
  #overlay.show { display: block; }
  #main-content { margin-left: 0; padding: 60px 14px 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .quick-btns { grid-template-columns: repeat(3, 1fr); }
  .av-logo { font-size: 26px; }
  .tab-btn { font-size: 12px; padding: 6px 10px; }
}
@media (max-width: 480px) {
  .quick-btns { grid-template-columns: repeat(2, 1fr); }
  .stats-row .stat-pill { min-width: 60px; }
  .grid-2 { grid-template-columns: 1fr; }
}
