/* MrBadmusAI — Global Design System */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --physics: #4ECDC4;
  --chemistry: #FF6B6B;
  --biology: #6BCB77;
  --yellow: #FFD93D;
  --orange: #FF6B35;
  --dark: #1A1A2E;
  --darker: #0F0F1A;
  --card: #16213E;
  --card2: #1A2545;
  --text: #E8F4FD;
  --muted: #8892A4;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--darker);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3, .brand { font-family: 'Fredoka One', cursive; }

a { color: inherit; text-decoration: none; }

/* ── NAV ── */
.nav {
  background: var(--dark);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-family: 'Fredoka One', cursive;
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.2s;
  opacity: 0.8;
}
.nav-links a:hover { background: rgba(255,255,255,0.1); opacity: 1; }
.nav-links a.active { background: rgba(255,255,255,0.15); opacity: 1; }
.nav-links a.phy { color: var(--physics); }
.nav-links a.che { color: var(--chemistry); }
.nav-links a.bio { color: var(--biology); }

/* ── HERO ── */
.hero {
  padding: 80px 24px;
  text-align: center;
  background: radial-gradient(ellipse at center, #1e2a4a 0%, var(--darker) 70%);
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 4rem); margin-bottom: 16px; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 600px; margin: 0 auto 40px; }
.hero-gradient { background: linear-gradient(135deg, var(--yellow), var(--orange)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ── SUBJECT CARDS (landing) ── */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px 80px;
}
.subject-card {
  background: var(--card);
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  border: 2px solid transparent;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  cursor: pointer;
  display: block;
}
.subject-card:hover { transform: translateY(-6px); box-shadow: 0 12px 40px rgba(0,0,0,0.5); }
.subject-card.phy { border-color: var(--physics); }
.subject-card.che { border-color: var(--chemistry); }
.subject-card.bio { border-color: var(--biology); }
.subject-card:hover.phy { box-shadow: 0 12px 40px rgba(78,205,196,0.25); }
.subject-card:hover.che { box-shadow: 0 12px 40px rgba(255,107,107,0.25); }
.subject-card:hover.bio { box-shadow: 0 12px 40px rgba(107,203,119,0.25); }
.subject-icon { font-size: 3.5rem; margin-bottom: 16px; display: block; }
.subject-card h2 { font-size: 1.8rem; margin-bottom: 8px; }
.subject-card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 20px; }
.subject-card .btn {
  display: inline-block;
  padding: 10px 28px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--darker);
  transition: opacity 0.2s;
}
.subject-card .btn:hover { opacity: 0.85; }
.phy .btn { background: var(--physics); }
.che .btn { background: var(--chemistry); }
.bio .btn { background: var(--biology); }

/* ── TOPIC HUB ── */
.hub-header {
  padding: 50px 24px 30px;
  text-align: center;
}
.hub-header h1 { font-size: 2.5rem; margin-bottom: 8px; }
.hub-header p { color: var(--muted); font-size: 1rem; }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
}
.topic-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  border-left: 4px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
}
.topic-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.topic-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.topic-card h3 { font-size: 1.1rem; flex: 1; }
.topic-card-meta { color: var(--muted); font-size: 0.8rem; margin-bottom: 12px; }
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  display: inline-block;
  margin: 2px;
  background: rgba(255,255,255,0.1);
}
.badge-rp { background: rgba(255,217,61,0.2); color: var(--yellow); }
.badge-h { background: rgba(78,205,196,0.2); color: var(--physics); }
.badge-t { background: rgba(255,107,107,0.15); color: #ff9999; }
.topic-card-footer { margin-top: 14px; }
.topic-card-footer .go-btn {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 18px;
  border-radius: 20px;
  color: var(--darker);
  display: inline-block;
}

/* ── TOPIC PAGE ── */
.topic-header {
  padding: 50px 24px 30px;
  max-width: 900px;
  margin: 0 auto;
}
.topic-header .back-link {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}
.topic-header .back-link:hover { color: var(--text); }
.topic-header h1 { font-size: 2.2rem; margin-bottom: 8px; }
.spec-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  color: var(--muted);
  margin-right: 8px;
}
.paper-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255,217,61,0.15);
  color: var(--yellow);
}

.content-area {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 120px;
}

.section { margin-bottom: 40px; }
.section-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
}

/* ── CARDS ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.06);
}
.card h4 { font-size: 1rem; margin-bottom: 10px; font-weight: 800; }

/* ── FORMULA PILLS ── */
.formula-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.formula-pill {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 18px;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ── FIFA BOX ── */
.fifa-box {
  background: linear-gradient(135deg, #1a2a1a, #1e2e1e);
  border: 2px solid #4CAF50;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.fifa-box .fifa-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: #4CAF50;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.fifa-step { display: flex; gap: 14px; margin-bottom: 10px; align-items: flex-start; }
.fifa-letter {
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #4CAF50;
  color: #0F1A0F;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.fifa-step p { font-size: 0.95rem; }
.fifa-answer { font-size: 1.1rem; font-weight: 800; color: #80FF80; }

/* ── HIGHER / TRIPLE BOXES ── */
.higher-box {
  background: rgba(78,205,196,0.07);
  border: 2px solid rgba(78,205,196,0.4);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 14px;
  position: relative;
}
.higher-box::before {
  content: '⭐ HIGHER TIER';
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--physics);
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 8px;
}
.triple-box {
  background: rgba(255,107,107,0.07);
  border: 2px solid rgba(255,107,107,0.3);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 14px;
  position: relative;
}
.triple-box::before {
  content: '🔬 TRIPLE ONLY';
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--chemistry);
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 8px;
}

/* ── SUBTOPIC LIST ── */
.subtopic-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.subtopic-list li {
  padding: 12px 16px;
  background: var(--card2);
  border-radius: 8px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 3px solid rgba(255,255,255,0.1);
  transition: border-color 0.2s, background 0.2s;
}
.subtopic-list li:hover { background: rgba(255,255,255,0.05); }

/* ── RP SECTION ── */
.rp-card {
  background: rgba(255,217,61,0.06);
  border: 2px solid rgba(255,217,61,0.3);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
}
.rp-card h4 { color: var(--yellow); font-size: 0.95rem; margin-bottom: 8px; }

/* ── QUIZ ── */
.quiz-card { background: var(--card); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.quiz-card .q-text { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  padding: 11px 16px;
  background: var(--card2);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  color: var(--text);
}
.quiz-opt:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.05); }
.quiz-opt.correct { border-color: #4CAF50; background: rgba(76,175,80,0.15); }
.quiz-opt.wrong { border-color: #f44336; background: rgba(244,67,54,0.15); }
.quiz-feedback { margin-top: 12px; font-size: 0.9rem; display: none; padding: 10px 14px; border-radius: 8px; }
.quiz-feedback.show { display: block; }
.quiz-feedback.correct-fb { background: rgba(76,175,80,0.15); color: #80FF80; }
.quiz-feedback.wrong-fb { background: rgba(244,67,54,0.15); color: #FF8080; }

/* ── CHAT FAB ── */
.chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  border: none;
  cursor: pointer;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 28px rgba(255,107,53,0.5);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 90;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 10px 40px rgba(255,107,53,0.7); }

/* ── CHAT OVERLAY ── */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.chat-overlay.open { pointer-events: all; opacity: 1; }
.chat-modal {
  width: 420px;
  max-width: calc(100vw - 32px);
  height: min(580px, calc(100vh - 100px));
  background: var(--dark);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0,0,0,0.8);
  transform: translateY(20px);
  transition: transform 0.25s;
}
.chat-overlay.open .chat-modal { transform: translateY(0); }
.chat-head {
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-head-info h3 { font-family: 'Fredoka One', cursive; font-size: 1.1rem; color: var(--darker); }
.chat-head-info p { font-size: 0.75rem; color: rgba(15,15,26,0.7); }
.close-btn { background: none; border: none; cursor: pointer; font-size: 1.4rem; color: var(--darker); line-height: 1; padding: 4px; }
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg { display: flex; gap: 10px; align-items: flex-start; }
.chat-msg--user { flex-direction: row-reverse; }
.chat-msg__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.chat-msg__bubble {
  background: var(--card);
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 80%;
}
.chat-msg--user .chat-msg__bubble { background: rgba(255,217,61,0.15); border-bottom-right-radius: 4px; }
.chat-msg--bot .chat-msg__bubble { border-bottom-left-radius: 4px; }
.typing span {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  margin: 0 2px;
  animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-8px)} }

.img-preview-row { display: none; align-items: center; gap: 8px; padding: 8px 16px; background: var(--card); }
.img-preview-row img { height: 60px; border-radius: 8px; }
.img-preview-row button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }

.chat-input-row {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  gap: 8px;
  align-items: center;
}
.chat-input-row input {
  flex: 1;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input-row input:focus { border-color: var(--yellow); }
.chat-input-row .img-btn, .chat-send-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s;
}
.chat-send-btn {
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  border-radius: 10px;
  font-size: 1.1rem;
  padding: 8px 14px;
}
.chat-send-btn:hover { opacity: 0.85; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .nav-links a { padding: 5px 10px; font-size: 0.8rem; }
  .topic-grid { grid-template-columns: 1fr; }
  .subject-grid { grid-template-columns: 1fr; }
}



/* ── PATHWAY CARDS (landing) ── */
.pathway-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 900px;
  margin: 40px auto;
  padding: 0 24px;
}
@media (max-width: 600px) { .pathway-grid { grid-template-columns: 1fr; } }

.pathway-card {
  background: var(--card);
  border-radius: 18px;
  padding: 36px 28px;
  text-align: center;
  text-decoration: none;
  border: 2px solid rgba(255,255,255,0.08);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: block;
}
.pathway-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.pathway-card.combined { border-color: rgba(78,205,196,0.4); }
.pathway-card.combined:hover { border-color: #4ECDC4; box-shadow: 0 12px 40px rgba(78,205,196,0.2); }
.pathway-card.triple { border-color: rgba(255,107,107,0.4); }
.pathway-card.triple:hover { border-color: #FF6B6B; box-shadow: 0 12px 40px rgba(255,107,107,0.2); }

.pathway-icon { font-size: 3rem; margin-bottom: 12px; }
.pathway-card h2 { font-size: 1.6rem; margin-bottom: 10px; }
.pathway-card p { font-size: 0.9rem; color: var(--muted); line-height: 1.6; margin-bottom: 20px; }
.pathway-badge-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pathway-badge { padding: 4px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 700; }

/* ── TIER CARDS ── */
.tier-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 700px;
  margin: 40px auto;
  padding: 0 24px;
}
@media (max-width: 500px) { .tier-grid { grid-template-columns: 1fr; } }

.tier-card {
  background: var(--card);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  text-decoration: none;
  border: 2px solid rgba(255,255,255,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
}
.tier-card:hover { transform: translateY(-3px); }
.tier-card.foundation { border-color: rgba(107,203,119,0.4); }
.tier-card.foundation:hover { border-color: #6BCB77; box-shadow: 0 8px 30px rgba(107,203,119,0.2); }
.tier-card.higher { border-color: rgba(255,217,61,0.4); }
.tier-card.higher:hover { border-color: #FFD93D; box-shadow: 0 8px 30px rgba(255,217,61,0.2); }

/* ── SUBJECT CARDS inside pathway ── */
.subject-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 900px;
  margin: 32px auto;
  padding: 0 24px;
}
@media (max-width: 700px) { .subject-row { grid-template-columns: 1fr; } }

/* ── NEXT/PREV NAVIGATION ── */
.subtopic-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.nav-arrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  transition: all 0.2s;
  max-width: 45%;
}
.nav-arrow:hover { border-color: var(--subject); color: var(--subject); background: rgba(255,255,255,0.04); }
.nav-arrow.prev::before { content: '←'; }
.nav-arrow.next::after  { content: '→'; }
.nav-arrow-label { font-size: 0.75rem; color: var(--muted); font-weight: 400; }
.nav-arrow-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.subtopic-nav-spacer { flex: 1; }

/* ── BREADCRUMB BAR ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 8px 0 4px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { opacity: 0.4; }
