/* ===== AI เพื่อเยาวชน - Modern AI Education Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;600;700&display=swap');

:root {
  --bg: #f0f9ff;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --secondary: #4f46e5;
  --secondary-light: #e0e7ff;
  --accent: #f59e0b;
  --border: #e2e8f0;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 4px 20px rgba(13, 148, 136, 0.12);
  --shadow-lg: 0 10px 40px rgba(13, 148, 136, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Sarabun', 'Segoe UI', system-ui, sans-serif;
  --gradient: linear-gradient(135deg, #0d9488 0%, #4f46e5 100%);
  --gradient-soft: linear-gradient(135deg, rgba(13,148,136,0.08) 0%, rgba(79,70,229,0.08) 100%);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #2dd4bf;
  --primary-dark: #14b8a6;
  --primary-light: #134e4a;
  --secondary: #818cf8;
  --secondary-light: #312e81;
  --border: #334155;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
  --gradient-soft: linear-gradient(135deg, rgba(45,212,191,0.1) 0%, rgba(129,140,248,0.1) 100%);
}

[data-theme="soft"] {
  --bg: #fffbeb;
  --bg-card: #fff7ed;
  --text: #422006;
  --text-muted: #78716c;
  --primary: #d97706;
  --primary-dark: #b45309;
  --primary-light: #fef3c7;
  --secondary: #ea580c;
  --border: #fde68a;
  --shadow: 0 4px 20px rgba(217,119,6,0.12);
  --gradient: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
  --gradient-soft: linear-gradient(135deg, rgba(217,119,6,0.1) 0%, rgba(234,88,12,0.08) 100%);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  transition: background 0.35s ease, color 0.35s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 1.75rem; }
.mt-3 { margin-top: 2.5rem; }

/* ===== Header ===== */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  gap: 1rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none !important;
  color: var(--text);
  flex-shrink: 0;
}
.logo img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--primary-light);
  padding: 4px;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.level {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}
.nav-link {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none !important;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.nav-link:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.nav-link.active {
  background: var(--primary);
  color: #fff !important;
}
.nav-link.level-link {
  background: var(--secondary);
  color: #fff !important;
  font-weight: 600;
}
.nav-link.level-link:hover {
  background: #4338ca;
  color: #fff !important;
}

.header-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.icon-btn {
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  font-size: 1.15rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text);
  line-height: 1;
  padding: 0;
}
.icon-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.98rem;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none !important;
  font-family: inherit;
}
.btn.primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(13,148,136,0.35);
}
.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13,148,136,0.45);
  color: #fff;
}
.btn.secondary {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn.secondary:hover {
  background: var(--primary);
  color: #fff;
}
.btn.large {
  padding: 0.95rem 1.9rem;
  font-size: 1.08rem;
  border-radius: 14px;
}

/* ===== Hero ===== */
.hero {
  padding: 3.5rem 0 4rem;
  background: var(--gradient-soft);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(13,148,136,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.hero .container {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.5rem;
  align-items: center;
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-size: clamp(1.75rem, 4.2vw, 2.55rem);
  line-height: 1.28;
  margin-bottom: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.highlight {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  font-size: 1.08rem;
  max-width: 520px;
}
.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-img, .hero-placeholder {
  max-width: 100%;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.hero-placeholder {
  background: var(--gradient);
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 4rem;
  text-align: center;
  padding: 2rem;
}
.hero-placeholder span {
  font-size: 1.1rem;
  margin-top: 0.75rem;
  font-weight: 600;
  opacity: 0.95;
}

/* ===== Features ===== */
.features {
  padding: 4rem 0 3rem;
}
.section-title {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--text);
}
.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-size: 1.05rem;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.feature-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.1rem;
  background: var(--primary-light);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
}
.feature-card h3 {
  margin-bottom: 0.55rem;
  font-size: 1.15rem;
  font-weight: 600;
}
.feature-card p {
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.6;
}

/* ===== Curriculum / Lessons ===== */
.curriculum-overview {
  padding: 2.5rem 0 4rem;
}
.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.lesson-item {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.4rem;
  text-decoration: none !important;
  color: var(--text);
  transition: all 0.25s ease;
}
.lesson-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateX(4px);
}
.lesson-num {
  background: var(--gradient);
  color: #fff;
  font-weight: 700;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.05rem;
}
.lesson-item h3 {
  font-size: 1.08rem;
  margin-bottom: 0.2rem;
  font-weight: 600;
}
.lesson-item p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ===== Levels Nav ===== */
.levels-nav {
  padding: 2rem 0 4.5rem;
}
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.15rem;
}
.level-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem;
  text-align: center;
  text-decoration: none !important;
  color: var(--text);
  transition: all 0.25s ease;
}
.level-card:hover, .level-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.level-badge {
  display: inline-block;
  background: var(--gradient);
  color: #fff;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.6rem;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2.25rem 0;
  margin-top: auto;
}
.footer-content { text-align: center; }
.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.6rem;
  font-size: 1.1rem;
}
.footer p { color: var(--text-muted); font-size: 0.92rem; }
.footer-note { margin-top: 1rem; font-size: 0.82rem; opacity: 0.85; }

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  text-align: center;
}
.modal-content h2 { margin-bottom: 1rem; font-size: 1.35rem; }
.dhikr {
  font-size: 1.45rem;
  direction: rtl;
  margin: 1rem 0 0.4rem;
  color: var(--primary);
  line-height: 1.6;
}
.dhikr-trans {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.35rem;
}
.health-tips {
  background: var(--primary-light);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  text-align: left;
  margin-bottom: 1.35rem;
}
.health-tips h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.health-tips ul { padding-left: 1.2rem; font-size: 0.92rem; }
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
}
.checkbox-label {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

/* ===== Lesson Page ===== */
.lesson-header {
  background: var(--gradient);
  color: #fff;
  padding: 2.25rem 0;
  margin-bottom: 2rem;
}
.lesson-header h1 {
  font-size: clamp(1.5rem, 3.5vw, 1.95rem);
  margin-bottom: 0.4rem;
  font-weight: 700;
}
.lesson-meta {
  opacity: 0.9;
  font-size: 0.95rem;
  font-weight: 500;
}
.lesson-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.lesson-content h2 {
  color: var(--primary);
  margin: 1.75rem 0 0.85rem;
  font-size: 1.35rem;
  font-weight: 700;
}
.lesson-content h2:first-child { margin-top: 0; }
.lesson-content p, .lesson-content li { margin-bottom: 0.8rem; }
.lesson-content ul, .lesson-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.1rem;
}
.example-box {
  background: var(--primary-light);
  border-left: 5px solid var(--primary);
  padding: 1.15rem 1.35rem;
  border-radius: 0 14px 14px 0;
  margin: 1.4rem 0;
}
.activity-box {
  background: var(--secondary-light);
  border: 1.5px dashed var(--secondary);
  border-radius: var(--radius);
  padding: 1.35rem;
  margin: 1.4rem 0;
}
.quiz-question {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.quiz-options label {
  display: block;
  padding: 0.65rem 1rem;
  margin: 0.4rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-card);
}
.quiz-options label:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.quiz-options input { margin-right: 0.55rem; }

/* ===== PRINT STYLES ===== */
@media print {
  .header,
  .footer,
  .hero-buttons,
  .levels-nav,
  .icon-btn,
  #reminder-modal,
  .nav,
  .header-actions,
  .btn,
  .quiz-question,
  .activity-box,
  .no-print,
  #quiz-result {
    display: none !important;
  }
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
  }
  .container { max-width: 100%; padding: 0; }
  .lesson-content, .feature-card, .lesson-item {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }
  a { color: black !important; text-decoration: none !important; }
  .lesson-header {
    background: #0d9488 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color: white !important;
  }
  .example-box {
    border-left: 4px solid #0d9488;
    background: #f0fdfa !important;
  }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .hero-buttons { justify-content: center; }
  .hero-visual { order: -1; }
}
@media (max-width: 900px) {
  .mobile-only { display: inline-flex !important; }
  .nav {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    gap: 0.2rem;
    z-index: 150;
  }
  .nav.open {
    display: flex !important;
  }
  .nav-link {
    width: 100%;
    text-align: center;
    padding: 0.85rem 1rem;
    border-radius: 10px;
  }
  .header-inner { position: relative; }
  .brand { font-size: 1.05rem; }
  .header-actions { margin-left: auto; }
}

.icon-btn {
  appearance: none !important;
  -webkit-appearance: none !important;
  outline: none !important;
  box-shadow: none !important;
  margin: 0 !important;
}
.header-actions .icon-btn + .icon-btn {
  margin-left: 0.35rem;
}
