/* Thai with Nong Thai — friendly Thai language theme */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --teal: #2a9d8f;
  --teal-dark: #21867a;
  --orange: #ff9f43;
  --orange-dark: #f0860f;
  --navy: #1d3557;
  --navy-dark: #16283f;
  --cream: #f7faf9;
  --cream-soft: #eef7f5;
  --ink: #213547;
  --ink-soft: #64717e;
  --gray-light: #e7edf0;
  --border: #dfe8ea;
  --green: #4caf82;
  --white: #ffffff;

  --shadow-sm: 0 2px 6px rgba(33,53,71,0.08);
  --shadow-md: 0 6px 20px rgba(33,53,71,0.12);
  --shadow-lg: 0 12px 36px rgba(33,53,71,0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: 0.22s ease;

  --font: 'Sarabun', sans-serif;
  --font-display: 'Baloo 2', 'Sarabun', sans-serif;
  --container: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; }
.text-center { text-align: center; }
.d-none { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border-radius: 999px; border: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-dark); }
.btn-secondary { background: var(--navy); color: var(--white); }
.btn-secondary:hover { background: var(--navy-dark); }
.btn-yellow { background: var(--orange); color: var(--white); }
.btn-yellow:hover { background: var(--orange-dark); }
.btn-outline { background: transparent; color: var(--teal); border: 2px solid var(--teal); box-shadow: none; }
.btn-outline:hover { background: var(--teal); color: var(--white); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 18px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
  background: var(--white); border-bottom: 3px solid var(--orange);
  position: sticky; top: 0; z-index: 100;
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; }
.navbar-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--teal); }
.navbar-brand svg { width: 40px; height: 40px; }
.navbar-nav { display: flex; align-items: center; gap: 22px; font-weight: 600; }
.navbar-nav a { color: var(--ink-soft); transition: color var(--transition); }
.navbar-nav a:hover, .navbar-nav a.active { color: var(--teal); }
.lang-switch { display: flex; gap: 6px; }
.lang-switch a { padding: 4px 10px; border-radius: 999px; background: var(--gray-light); font-size: 0.85rem; font-weight: 700; }
.lang-switch a.active { background: var(--navy); color: var(--white); }
.navbar-toggle { display: none; background: none; border: none; font-size: 1.6rem; color: var(--ink); }

@media (max-width: 820px) {
  .navbar-nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--white);
    flex-direction: column; align-items: flex-start; padding: 16px 20px; gap: 14px;
    box-shadow: var(--shadow-md); display: none; }
  .navbar-nav.open { display: flex; }
  .navbar-toggle { display: block; }
}

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--teal) 100%);
  color: var(--white); padding: 60px 0 80px; position: relative; overflow: hidden;
}
.hero .container { display: flex; align-items: center; gap: 40px; flex-wrap: wrap; }
.hero-text { flex: 1 1 340px; }
.hero-text h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 14px; text-shadow: 0 2px 0 rgba(0,0,0,0.12); }
.hero-text p { font-size: 1.05rem; margin-bottom: 26px; opacity: 0.95; }
.hero-mascot { flex: 1 1 260px; max-width: 280px; margin: 0 auto; }

/* ── Section headings ───────────────────────────────────────────── */
.section { padding: 56px 0; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.section-heading h2 { font-size: 1.6rem; color: var(--ink); }
.section-heading::before { content: ''; width: 8px; height: 32px; background: var(--orange); border-radius: 4px; }

/* ── Course picker ───────────────────────────────────────────────── */
.course-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.course-card {
  background: var(--white); border-radius: var(--radius-lg); padding: 30px;
  box-shadow: var(--shadow-sm); border: 2px solid var(--border); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--teal); }
.course-card-badge {
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--white);
  background: var(--navy); padding: 8px 22px; border-radius: 999px;
}
.course-card-desc { color: var(--ink-soft); font-size: 0.95rem; min-height: 44px; }
.course-card-progress { width: 100%; }
.course-card-progress-bar { width: 100%; height: 10px; background: var(--gray-light); border-radius: 999px; overflow: hidden; }
.course-card-progress-bar span { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.course-card-progress-label { font-size: 0.8rem; color: var(--ink-soft); margin-top: 6px; }

/* ── Coming soon panel ──────────────────────────────────────────── */
.coming-soon-card {
  background: var(--white); border-radius: var(--radius-lg); padding: 44px 30px;
  box-shadow: var(--shadow-sm); border: 2px solid var(--border); text-align: center;
  max-width: 640px; margin: 0 auto;
}
.coming-soon-card .badge-soon {
  display: inline-block; background: var(--orange); color: var(--white); font-family: var(--font-display);
  font-weight: 700; padding: 6px 20px; border-radius: 999px; margin-bottom: 16px; font-size: 0.9rem;
}
.coming-soon-card p { color: var(--ink-soft); margin: 12px 0 24px; }

/* ── Forms ───────────────────────────────────────────────────────── */
.auth-wrap { max-width: 440px; margin: 60px auto; background: var(--white); border-radius: var(--radius-lg);
  padding: 36px; box-shadow: var(--shadow-md); }
.auth-wrap h1 { text-align: center; margin-bottom: 24px; color: var(--teal); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
.form-group input { width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 2px solid var(--border);
  font-size: 1rem; font-family: var(--font); transition: border-color var(--transition); }
.form-group input:focus { outline: none; border-color: var(--teal); }
.form-error { background: #ffe8e6; color: #c0392b; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; }
.form-success { background: #eafaf1; color: #2f8a5f; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 0.9rem; color: var(--ink-soft); }
.auth-switch a { color: var(--teal-dark); font-weight: 700; }

/* ── Account dashboard ──────────────────────────────────────────── */
.account-layout { display: flex; gap: 30px; align-items: flex-start; flex-wrap: wrap; }
.account-sidebar { flex: 0 0 220px; background: var(--white); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); }
.account-sidebar .avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--orange); margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 800; color: var(--white); }
.account-nav { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.account-nav a { padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600; color: var(--ink-soft); }
.account-nav a.active, .account-nav a:hover { background: var(--cream-soft); color: var(--teal); }
.account-content { flex: 1 1 460px; }

/* ── Roadmap / day grid ─────────────────────────────────────────── */
.roadmap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.day-card {
  background: var(--white); border-radius: var(--radius-md); padding: 18px 14px;
  text-align: center; box-shadow: var(--shadow-sm); border: 2px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.day-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.day-card .day-num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; color: var(--teal); }
.day-card .day-title { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; min-height: 34px; }
.day-card.is-exam { border-color: var(--orange); background: #fff6ea; }
.day-card.is-intro { border-color: var(--teal); background: #eafbf9; }
.day-card.is-intro .day-num { font-size: 1.6rem; }
.day-card.is-completed { border-color: var(--green); }
.day-card.is-completed::after { content: '✓'; position: absolute; top: -10px; right: -10px;
  width: 28px; height: 28px; background: var(--green); color: var(--white); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 800; box-shadow: var(--shadow-sm); }
.day-card.is-locked { opacity: 0.55; filter: grayscale(0.4); pointer-events: none; }
.day-card .badge { display: inline-block; margin-top: 6px; font-size: 0.7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--orange); color: var(--white); }

/* ── Lesson intro / mascot bubble ───────────────────────────────── */
.mascot-intro { display: flex; align-items: flex-start; gap: 16px; background: var(--white);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 30px; }
.mascot-intro .mascot-icon { width: 72px; flex-shrink: 0; }
.speech-bubble { background: var(--cream-soft); border-radius: var(--radius-md); padding: 14px 18px; flex: 1; }

/* ── Lesson content blocks ───────────────────────────────────────── */
.lesson-block { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  border: 2px solid var(--border); padding: 20px; margin-bottom: 20px; text-align: center; }
.lesson-image { max-width: 100%; width: 380px; margin: 0 auto 16px; border-radius: var(--radius-md); }
.lesson-text { font-size: 1.05rem; line-height: 1.7; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lesson-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }

/* ── Listen (text-to-speech) button ─────────────────────────────── */
.listen-btn { flex-shrink: 0; background: var(--orange); border: none; border-radius: 999px;
  width: 34px; height: 34px; font-size: 1rem; box-shadow: var(--shadow-sm); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center; }
.listen-btn:hover { background: var(--orange-dark); }

/* ── Quiz ────────────────────────────────────────────────────────── */
.quiz-question { background: var(--white); border-radius: var(--radius-md); padding: 22px; box-shadow: var(--shadow-sm);
  margin-bottom: 20px; border: 2px solid var(--border); text-align: center; }
.quiz-question .qnum { display: inline-block; background: var(--teal); color: var(--white); font-weight: 700;
  border-radius: 999px; width: 28px; height: 28px; text-align: center; line-height: 28px; margin-right: 8px; }
.quiz-question .qtext { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.quiz-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.quiz-option { display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--cream-soft); border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; text-align: center; font-weight: 600; transition: all var(--transition); cursor: pointer; }
.quiz-option:hover { border-color: var(--teal); }
.quiz-option input { display: none; }
.quiz-option input:checked + span { color: var(--teal-dark); }
.quiz-result { text-align: center; background: var(--white); border-radius: var(--radius-lg); padding: 40px; box-shadow: var(--shadow-md); }
.quiz-result .score { font-family: var(--font-display); font-size: 3rem; color: var(--teal); font-weight: 800; }

/* ── Worksheet ───────────────────────────────────────────────────── */
.worksheet-header { text-align: center; margin-bottom: 30px; }
.worksheet-list { display: flex; flex-direction: column; gap: 10px; max-width: 720px; margin: 0 auto; }
.worksheet-list-row { display: flex; align-items: center; gap: 16px; background: var(--white); border-radius: var(--radius-sm);
  padding: 12px 16px; box-shadow: var(--shadow-sm); border: 2px solid var(--border); flex-wrap: wrap; }
.worksheet-list-row.is-completed { border-color: var(--green); }
.worksheet-list-row .wl-day { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--teal);
  width: 34px; flex-shrink: 0; text-align: center; }
.worksheet-list-row .wl-title { flex: 1; font-weight: 600; }
.worksheet-list-row .wl-title .badge { display: inline-block; margin-left: 8px; font-size: 0.7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--orange); color: var(--white); }
.worksheet-list-row .wl-actions { display: flex; gap: 8px; flex-shrink: 0; }
.worksheet-content { max-width: 640px; margin: 0 auto; }
.match-row { background: var(--white); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.match-row .qnum { display: inline-block; background: var(--teal); color: var(--white); font-weight: 700;
  border-radius: 999px; width: 26px; height: 26px; text-align: center; line-height: 26px; font-size: 0.85rem; }

/* ── Footer ──────────────────────────────────────────────────────── */
.site-footer { background: var(--ink); color: rgba(255,255,255,0.8); padding: 34px 0; text-align: center; margin-top: 60px; font-size: 0.9rem; }
.site-footer .mascot-mini { width: 46px; margin: 0 auto 10px; }

@media (max-width: 600px) {
  .account-layout { flex-direction: column; }
  .account-sidebar { width: 100%; }
}

/* ── Admin panel ─────────────────────────────────────────────────── */
.admin-subnav { background: var(--ink); }
.admin-subnav .container { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-subnav a { color: rgba(255,255,255,0.7); padding: 12px 16px; font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.admin-subnav a:hover, .admin-subnav a.active { color: #fff; background: rgba(255,255,255,0.1); }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-top: 20px; }
.admin-stat-card { background: var(--white); border-radius: var(--radius-md); padding: 20px; text-align: center; box-shadow: var(--shadow-sm); border: 2px solid var(--border); }
.admin-stat-card .num { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--teal); }
.admin-stat-card .label { font-size: 0.85rem; color: var(--ink-soft); margin-top: 4px; }
.admin-table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 2px solid var(--border); margin-top: 10px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table th { background: var(--cream-soft); font-weight: 700; color: var(--ink); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--cream-soft); }
.admin-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-transform: capitalize; }
.admin-form-row { margin-bottom: 14px; }
.admin-form-row label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; }
.admin-form-row input[type="text"], .admin-form-row input[type="email"], .admin-form-row input[type="number"],
.admin-form-row input[type="date"], .admin-form-row select, .admin-form-row textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 2px solid var(--border); font-family: inherit; font-size: 0.95rem;
}
.admin-search { padding: 9px 14px; border-radius: 999px; border: 2px solid var(--border); width: 100%; max-width: 320px; margin-bottom: 14px; }
.admin-card { background: var(--white); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); border: 2px solid var(--border); margin-bottom: 20px; }
