/* ============================================================
   ENGLISHPATH — Mobile-First Responsive Stylesheet
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=DM+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --navy:     #0B1D3A;
  --navy2:    #122348;
  --navy3:    #1a3060;
  --blue:     #1A56C4;
  --sky:      #3B82F6;
  --gold:     #F5A623;
  --gold2:    #D4891A;
  --mint:     #10B981;
  --coral:    #F4614B;
  --violet:   #7C3AED;
  --cream:    #FDF8F0;
  --offwhite: #F5F0E8;
  --border:   #E5DDD0;
  --text:     #1C1C1E;
  --muted:    #6B7280;
  --white:    #ffffff;
  --sidebar-w: 270px;
  --topbar-h:  60px;
  --bottomnav-h: 64px;
  --radius:   16px;
  --radius-sm: 10px;
  --shadow:   0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR (Desktop)
══════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.sidebar::after {
  content: '';
  position: absolute;
  bottom: -100px; right: -100px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,166,35,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.sidebar-logo {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.logo-mark { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px;
  background: var(--gold);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 700; color: var(--white);
}
.logo-text span { color: var(--gold); }
.sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--white);
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  align-items: center; justify-content: center;
}

.sidebar-phase {
  padding: 14px 20px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.phase-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(255,255,255,0.4); margin-bottom: 4px;
}
.phase-current { font-size: 13px; font-weight: 600; color: var(--gold); }

.sidebar-nav { padding: 12px 10px; flex: 1; }
.nav-section-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(255,255,255,0.3); padding: 8px 12px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: rgba(255,255,255,0.6);
  text-decoration: none; font-size: 14px; font-weight: 500;
  transition: all 0.15s; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(245,166,35,0.15); color: var(--gold); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--gold); color: var(--navy);
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
}

.sidebar-stats {
  padding: 14px 20px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.stat-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.stat-item { text-align: center; }
.stat-val {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 700; color: var(--gold);
  display: block; line-height: 1;
}
.stat-lbl {
  font-size: 10px; color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: 0.8px;
  display: block; margin-top: 2px;
}

/* ── Overlay (mobile) ────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ══════════════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Top Bar ─────────────────────────────────────────────────── */
.topbar {
  background: var(--white);
  border-bottom: 1.5px solid var(--border);
  padding: 0 28px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn {
  display: none;
  background: none; border: none;
  color: var(--text); cursor: pointer;
  font-size: 22px; padding: 4px;
  flex-shrink: 0; border-radius: 8px;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  transition: background 0.15s;
}
.menu-btn:hover { background: var(--offwhite); }
.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-pills { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.xp-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--cream); border: 1.5px solid var(--border);
  border-radius: 99px; padding: 5px 14px;
  font-size: 13px; font-weight: 600;
}
.xp-pill .xp-num { color: var(--gold2); font-family: 'DM Mono', monospace; }
.streak-pill {
  display: flex; align-items: center; gap: 6px;
  background: #FFF8EB; border: 1.5px solid #FDECC8;
  border-radius: 99px; padding: 5px 12px;
  font-size: 13px; font-weight: 600; color: var(--gold2);
}

/* ── Content Area ───────────────────────────────────────────── */
.content {
  padding: 28px 32px;
  padding-bottom: 40px;
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════
   BOTTOM NAV (Mobile only, hidden on desktop)
══════════════════════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--white);
  border-top: 1.5px solid var(--border);
  z-index: 150;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-inner {
  display: flex;
  align-items: stretch;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}
.bnav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-size: 10px; font-weight: 600;
  padding: 6px 4px;
  border-radius: 10px;
  transition: all 0.15s;
  letter-spacing: 0.3px;
  position: relative;
}
.bnav-item.active { color: var(--navy); }
.bnav-item.active .bnav-icon-wrap {
  background: rgba(26,86,196,0.1);
  border-radius: 10px;
}
.bnav-icon-wrap {
  width: 36px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  transition: all 0.15s;
}
.bnav-item.active .bnav-icon-wrap { transform: translateY(-2px); }
.bnav-label { font-size: 10px; font-weight: 600; }

/* ══════════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════════ */
.card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px; font-weight: 700; margin-bottom: 14px;
}

/* ── Grid ───────────────────────────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-bar {
  height: 8px; background: var(--offwhite);
  border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: var(--blue); transition: width 0.6s ease;
}

/* ══════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-weight: 600;
  border-radius: 12px; transition: all 0.15s;
  text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--navy); color: var(--white); padding: 12px 22px; font-size: 14px; }
.btn-primary:hover { background: var(--navy3); }
.btn-gold { background: var(--gold); color: var(--navy); padding: 12px 22px; font-size: 14px; }
.btn-gold:hover { background: var(--gold2); }
.btn-outline {
  background: transparent; border: 1.5px solid var(--border);
  color: var(--text); padding: 10px 18px; font-size: 14px;
}
.btn-outline:hover { border-color: var(--navy); background: var(--cream); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ══════════════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px; letter-spacing: 0.4px;
}
.badge-blue   { background: #EFF6FF; color: var(--blue); }
.badge-green  { background: #ECFDF5; color: #059669; }
.badge-gold   { background: #FFFBEB; color: var(--gold2); }
.badge-violet { background: #F5F3FF; color: var(--violet); }
.badge-coral  { background: #FEF2F2; color: #DC2626; }
.badge-navy   { background: var(--navy); color: var(--gold); }

/* ══════════════════════════════════════════════════════════════
   FLASHCARD
══════════════════════════════════════════════════════════════ */
.flashcard-wrap {
  perspective: 1000px;
  width: 100%; max-width: 520px;
  margin: 0 auto; height: 260px;
}
.flashcard {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s;
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.card-face {
  position: absolute; width: 100%; height: 100%;
  backface-visibility: hidden;
  border-radius: 18px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px; text-align: center;
}
.card-front { background: var(--navy); color: var(--white); border: 2px solid var(--navy3); }
.card-back  { background: var(--white); border: 2px solid var(--border); transform: rotateY(180deg); }
.card-word {
  font-family: 'Playfair Display', serif;
  font-size: 38px; font-weight: 700;
  color: var(--gold); margin-bottom: 10px;
}
.card-hint { font-size: 13px; color: rgba(255,255,255,0.45); margin-top: 14px; }
.card-meaning { font-size: 22px; font-weight: 600; color: var(--navy); margin-bottom: 10px; }
.card-example { font-size: 13px; color: var(--muted); font-style: italic; line-height: 1.5; }

/* ══════════════════════════════════════════════════════════════
   QUIZ OPTIONS
══════════════════════════════════════════════════════════════ */
.quiz-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 14px; cursor: pointer;
  margin-bottom: 10px; transition: all 0.15s;
  font-size: 15px; font-weight: 500;
  background: var(--white);
  -webkit-tap-highlight-color: transparent;
}
.quiz-option:hover  { border-color: var(--blue); background: #EFF6FF; }
.quiz-option:active { transform: scale(0.98); }
.quiz-option.correct { border-color: var(--mint); background: #ECFDF5; color: #065F46; }
.quiz-option.wrong   { border-color: var(--coral); background: #FEF2F2; color: #DC2626; }
.quiz-option .opt-letter {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--offwhite);
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   ACTIVITY ROW
══════════════════════════════════════════════════════════════ */
.activity-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1.5px solid var(--border);
}
.activity-row:last-child { border-bottom: none; }
.activity-icon-wrap {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--offwhite);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.activity-meta { flex: 1; min-width: 0; }
.activity-name { font-weight: 600; font-size: 14px; }
.activity-duration { font-size: 12px; color: var(--muted); }
.activity-check {
  width: 30px; height: 30px; border-radius: 9px;
  border: 2px solid var(--border); background: var(--white);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all 0.18s; flex-shrink: 0;
}
.activity-check.done { background: var(--mint); border-color: var(--mint); color: var(--white); }

/* ══════════════════════════════════════════════════════════════
   SPEAKING
══════════════════════════════════════════════════════════════ */
.speaking-card {
  background: var(--navy); color: var(--white);
  border-radius: 20px; padding: 28px;
  position: relative; overflow: hidden; margin-bottom: 20px;
}
.speaking-card::before {
  content: ''; position: absolute; top: -80px; right: -80px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle,rgba(245,166,35,0.15) 0%,transparent 70%);
  pointer-events: none;
}
.speaking-topic {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin-bottom: 10px;
}
.speaking-prompt-text {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 700; line-height: 1.4; margin-bottom: 20px;
}
.timer-display {
  font-family: 'DM Mono', monospace;
  font-size: 48px; font-weight: 500;
  color: var(--gold); display: block;
  margin-bottom: 18px; line-height: 1;
}
.timer-controls { display: flex; gap: 10px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 80px; right: 16px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--navy); color: var(--white);
  padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.3s ease; max-width: 300px;
}
@keyframes slideIn {
  from { opacity:0; transform: translateY(16px); }
  to   { opacity:1; transform: translateY(0); }
}
.toast .toast-xp {
  background: var(--gold); color: var(--navy);
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 99px; margin-left: auto; white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════════════ */
.sep { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--muted); }
.text-gold  { color: var(--gold2); }
.text-sm    { font-size: 13px; }
.mono       { font-family: 'DM Mono', monospace; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-12 { gap: 12px; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 1024px)
══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .content { padding: 24px; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 768px)
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Sidebar menjadi Drawer ── */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.open { display: block; }
  .sidebar-close-btn { display: flex; }

  /* ── Main area full width ── */
  .main { margin-left: 0; }

  /* ── Top bar ── */
  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 17px; }
  .menu-btn { display: flex; }
  .streak-pill { display: none; } /* save space, shown in sidebar */

  /* ── Content ── */
  .content {
    padding: 16px;
    padding-bottom: calc(var(--bottomnav-h) + 16px);
  }

  /* ── Bottom Nav visible ── */
  .bottom-nav { display: flex; align-items: stretch; }

  /* ── Cards ── */
  .card { padding: 16px; border-radius: 14px; }
  .card-title { font-size: 16px; }

  /* ── Grids ── */
  .grid-3 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid-2 { grid-template-columns: 1fr; gap: 12px; }

  /* ── Flashcard ── */
  .flashcard-wrap { height: 200px; }
  .card-word { font-size: 30px; }
  .card-meaning { font-size: 18px; }
  .card-face { padding: 20px; }

  /* ── Quiz options ── */
  .quiz-option { padding: 12px 14px; font-size: 14px; gap: 12px; }

  /* ── Speaking ── */
  .speaking-prompt-text { font-size: 17px; }
  .timer-display { font-size: 40px; }

  /* ── Toast ── */
  .toast-container {
    bottom: calc(var(--bottomnav-h) + 10px);
    right: 12px; left: 12px;
  }
  .toast { max-width: 100%; }

  /* ── Buttons ── */
  .btn-primary, .btn-gold { padding: 11px 18px; font-size: 14px; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (≤ 480px)
══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .grid-3 { grid-template-columns: 1fr; }
  .topbar-title { font-size: 15px; }
  .xp-pill { padding: 5px 10px; font-size: 12px; }
  .card-word { font-size: 26px; }

  /* Grammar layout stacked */
  .grammar-layout { grid-template-columns: 1fr !important; }
}
