/* =============================================
   BioPath Cambridge - Dark Green Theme
   ============================================= */

:root {
  --bg-primary:    #070f08;
  --bg-secondary:  #0d1a0e;
  --bg-card:       #111f12;
  --bg-card-hover: #162818;
  --bg-input:      #0a150b;
  --green-primary: #2e7d32;
  --green-light:   #66bb6a;
  --green-dark:    #1b5e20;
  --green-glow:    rgba(46, 125, 50, 0.22);
  --green-border:  rgba(46, 125, 50, 0.32);
  --gold:   #ffd700;
  --blue:   #42a5f5;
  --red-err:#ff4444;
  --teal:   #26c6da;
  --purple: #ce93d8;
  --text-primary:   #e8f5e9;
  --text-secondary: #81a884;
  --text-muted:     #3d5c40;
  --border-color:   rgba(46, 125, 50, 0.18);
  --success-bg:     rgba(46, 125, 50, 0.2);
  --radius:    14px;
  --radius-sm:  8px;
  --radius-lg: 20px;
  --shadow:      0 8px 32px rgba(0,0,0,0.6);
  --shadow-green: 0 0 30px rgba(46, 125, 50, 0.18);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--green-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-primary); }

/* ---- NAVBAR ---- */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(7, 15, 8, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  height: 64px; display: flex; align-items: center;
  justify-content: space-between; gap: 24px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-primary);
  font-weight: 700; font-size: 1.1rem;
}
.logo-icon { font-size: 1.5rem; }
.logo-text { color: var(--green-light); letter-spacing: -0.5px; }
.logo-sub {
  font-size: 0.65rem; color: var(--text-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: 1px;
  align-self: flex-end; padding-bottom: 2px;
}
.nav-links { display: flex; gap: 8px; }
.nav-links a {
  color: var(--text-secondary); text-decoration: none;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500; transition: var(--transition);
}
.nav-links a:hover { color: var(--green-light); background: var(--green-glow); }
.nav-toggle {
  display: none; background: none;
  border: 1px solid var(--border-color);
  color: var(--green-primary); font-size: 1.2rem;
  padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer;
}
.mobile-menu {
  display: none; flex-direction: column;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
}
.mobile-menu a {
  color: var(--text-secondary); text-decoration: none;
  padding: 10px 0; border-bottom: 1px solid var(--border-color); font-weight: 500;
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu.open { display: flex; }

.main-content { min-height: calc(100vh - 64px); }

/* ---- HERO ---- */
.hero {
  position: relative; overflow: hidden;
  padding: 80px 24px; text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(46,125,50,0.14) 0%, transparent 70%);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232e7d32' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-glow); border: 1px solid var(--green-border);
  color: var(--green-light); padding: 6px 16px; border-radius: 100px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.5px;
  margin-bottom: 24px; text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800;
  line-height: 1.15; letter-spacing: -1px; margin-bottom: 16px;
}
.hero h1 .highlight {
  background: linear-gradient(135deg, var(--green-light), var(--teal));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero p {
  font-size: 1.1rem; color: var(--text-secondary);
  max-width: 600px; margin: 0 auto 40px; line-height: 1.7;
}
.hero-stats { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; margin-top: 40px; }
.stat-item { text-align: center; }
.stat-num { font-size: 1.8rem; font-weight: 800; color: var(--green-light); display: block; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.hero-floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floater { position: absolute; font-size: 1.5rem; opacity: 0.07; animation: floatAnim 6s ease-in-out infinite; }
@keyframes floatAnim {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

.section { padding: 60px 24px; }
.section-inner { max-width: 1280px; margin: 0 auto; }
.section-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.5px; }
.section-title .emoji { margin-right: 8px; }
.section-sub { color: var(--text-secondary); margin-bottom: 40px; font-size: 0.95rem; }

/* ---- YEAR CARDS ---- */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.year-card {
  position: relative; background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  padding: 28px 24px; text-decoration: none; color: var(--text-primary);
  transition: var(--transition); overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
}
.year-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--green-primary), var(--green-light));
  transform: scaleX(0); transition: var(--transition); transform-origin: left;
}
.year-card:hover { background: var(--bg-card-hover); border-color: var(--green-border); transform: translateY(-4px); box-shadow: var(--shadow-green); }
.year-card:hover::before { transform: scaleX(1); }
.year-emoji { font-size: 2.5rem; }
.year-name { font-size: 1.1rem; font-weight: 700; color: var(--green-light); }
.year-desc { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }
.year-badge {
  display: inline-flex; gap: 4px; background: var(--green-glow);
  border: 1px solid var(--green-border); color: var(--green-light);
  font-size: 0.72rem; padding: 3px 10px; border-radius: 100px;
  font-weight: 600; margin-top: auto;
}

/* ---- TOPIC CARDS ---- */
.subject-section { margin-bottom: 48px; }
.subject-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}
.subject-emoji { font-size: 1.8rem; }
.subject-name { font-size: 1.3rem; font-weight: 700; }
.subject-count { color: var(--text-muted); font-size: 0.85rem; margin-left: auto; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.topic-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 20px; text-decoration: none;
  color: var(--text-primary); transition: var(--transition);
  display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden;
}
.topic-card:hover { background: var(--bg-card-hover); border-color: var(--green-border); transform: translateY(-2px); box-shadow: var(--shadow); }
.topic-icon { font-size: 1.8rem; }
.topic-name { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.topic-desc { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; flex: 1; }
.topic-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.difficulty-dots { display: flex; gap: 4px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.dot.active { background: var(--green-light); }
.topic-arrow { color: var(--green-primary); font-size: 1rem; }

/* ---- LESSON HERO ---- */
.lesson-hero {
  background: linear-gradient(180deg, rgba(46,125,50,0.1) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-color); padding: 40px 24px;
}
.lesson-hero-inner { max-width: 1280px; margin: 0 auto; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--green-primary); text-decoration: none; }
.breadcrumb a:hover { color: var(--green-light); }
.breadcrumb-sep { color: var(--text-muted); }
.lesson-title-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.lesson-big-icon { font-size: 3rem; }
.lesson-title { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: -0.5px; }
.lesson-subtitle { color: var(--text-secondary); margin-top: 4px; font-size: 0.95rem; }

/* ---- TABS ---- */
#lessonTabs { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.content-tabs {
  display: flex; gap: 4px; border-bottom: 2px solid var(--border-color);
  margin-bottom: 32px; overflow-x: auto; padding-bottom: 0;
}
.tab-btn {
  background: none; border: none; color: var(--text-muted);
  padding: 12px 20px; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: var(--transition); white-space: nowrap; font-family: var(--font-main);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--green-light); border-bottom-color: var(--green-primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- THEORY BLOCKS ---- */
.theory-block {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 28px; margin-bottom: 20px;
}
.theory-block h3 { font-size: 1.15rem; font-weight: 700; color: var(--green-light); margin-bottom: 12px; }
.theory-block p { color: var(--text-secondary); line-height: 1.7; margin-bottom: 12px; }
.theory-block table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.88rem; }
.theory-block th { background: var(--bg-secondary); color: var(--green-light); padding: 10px 14px; text-align: left; font-weight: 600; }
.theory-block td { padding: 9px 14px; border-bottom: 1px solid var(--border-color); color: var(--text-secondary); }
.theory-block tr:last-child td { border-bottom: none; }
.theory-block tr:hover td { background: rgba(46,125,50,0.05); }
.key-formula {
  background: var(--bg-secondary); border: 1px solid var(--green-border);
  border-left: 4px solid var(--green-primary); border-radius: var(--radius-sm);
  padding: 16px 20px; margin: 16px 0; text-align: center;
}
.key-formula-label { font-size: 0.75rem; color: var(--green-primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.example-block {
  background: rgba(46,125,50,0.07); border: 1px solid var(--green-border);
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 12px 0;
  font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6;
}
.tip-box {
  background: rgba(0, 230, 118, 0.07); border: 1px solid rgba(0, 230, 118, 0.25);
  border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0;
  font-size: 0.85rem; color: var(--text-secondary); display: flex; gap: 10px; align-items: flex-start;
}
.tip-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.warning-box {
  background: rgba(255, 193, 7, 0.07); border: 1px solid rgba(255, 193, 7, 0.25);
  border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0;
  font-size: 0.85rem; color: var(--text-secondary); display: flex; gap: 10px; align-items: flex-start;
}
.warning-icon { font-size: 1rem; flex-shrink: 0; }
.steps-list { padding-left: 20px; color: var(--text-secondary); font-size: 0.88rem; line-height: 1.8; }

/* ---- CALCULATOR / TOOL ---- */
.controls-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ctrl-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
.ctrl-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.ctrl-input {
  background: var(--bg-input); border: 1px solid var(--green-border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text-primary); font-family: var(--font-main); font-size: 0.9rem;
  transition: var(--transition); width: 100%;
}
.ctrl-input:focus { outline: none; border-color: var(--green-primary); box-shadow: 0 0 0 3px var(--green-glow); }
.ctrl-select {
  background: var(--bg-input); border: 1px solid var(--green-border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text-primary); font-family: var(--font-main); font-size: 0.9rem;
  cursor: pointer; width: 100%;
}
.result-box {
  background: var(--bg-secondary); border: 1px solid var(--green-border);
  border-radius: var(--radius-sm); padding: 14px 18px; margin-top: 8px;
  font-size: 0.9rem; color: var(--text-secondary); min-height: 52px;
}
.calc-step { margin-bottom: 6px; line-height: 1.6; }
.calc-answer {
  margin-top: 10px; padding: 10px 14px;
  background: var(--green-glow); border: 1px solid var(--green-border);
  border-radius: var(--radius-sm); font-size: 1rem;
  color: var(--green-light); font-weight: 600;
}
.tool-wrap {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 24px;
}
.tool-header {
  background: var(--bg-secondary); border-bottom: 1px solid var(--border-color);
  padding: 14px 24px; display: flex; align-items: center; gap: 10px;
  font-weight: 600; color: var(--green-light); font-size: 0.95rem;
}
.tool-header-icon { font-size: 1.2rem; }
.tool-body { padding: 24px; }
.canvas-wrap { width: 100%; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-input); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem; font-family: var(--font-main);
  cursor: pointer; border: none; text-decoration: none;
  transition: var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--green-primary); color: #fff; }
.btn-primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-secondary); color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { border-color: var(--green-border); color: var(--green-light); }
.btn-ghost { background: transparent; color: var(--green-primary); border: 1px solid var(--green-border); }
.btn-ghost:hover { background: var(--green-glow); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 100px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-green { background: var(--green-glow); color: var(--green-light); border: 1px solid var(--green-border); }
.badge-teal { background: rgba(38,198,218,0.15); color: var(--teal); border: 1px solid rgba(38,198,218,0.3); }
.badge-blue { background: rgba(66,165,245,0.15); color: var(--blue); border: 1px solid rgba(66,165,245,0.3); }

/* ---- QUIZ ---- */
.quiz-counter { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.quiz-counter-text { color: var(--text-muted); font-size: 0.85rem; }
.score-badge { background: var(--green-glow); border: 1px solid var(--green-border); color: var(--green-light); padding: 4px 12px; border-radius: 100px; font-size: 0.8rem; font-weight: 600; }
.quiz-progress-bar { height: 4px; background: var(--bg-secondary); border-radius: 2px; margin-bottom: 20px; }
.quiz-progress-fill { height: 100%; background: var(--green-primary); border-radius: 2px; transition: width 0.4s; }
.question-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 28px; margin-bottom: 16px; }
.q-number { font-size: 0.75rem; color: var(--green-primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }
.q-text { font-size: 1.05rem; font-weight: 600; line-height: 1.6; margin-bottom: 20px; }
.q-latex { margin: 12px 0; text-align: center; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option-btn {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-secondary); border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 12px 16px;
  text-align: left; cursor: pointer; color: var(--text-secondary);
  font-size: 0.9rem; transition: var(--transition); font-family: var(--font-main);
}
.option-btn:hover:not(:disabled) { border-color: var(--green-border); color: var(--text-primary); background: var(--bg-card); }
.option-btn.correct { border-color: var(--green-primary); background: var(--success-bg); color: var(--green-light); }
.option-btn.wrong { border-color: var(--red-err); background: rgba(255,68,68,0.1); color: var(--red-err); }
.option-letter {
  min-width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-card); border: 1.5px solid var(--border-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; flex-shrink: 0;
}
.explanation-box {
  background: var(--bg-secondary); border: 1px solid var(--green-border);
  border-radius: var(--radius-sm); padding: 14px 18px; margin-top: 16px;
  font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6;
  display: none;
}
.explanation-box.show { display: block; }
.quiz-nav { display: flex; gap: 10px; justify-content: space-between; }
.results-card { text-align: center; padding: 40px 24px; }
.result-emoji { font-size: 4rem; display: block; margin-bottom: 16px; }
.result-score-big { font-size: 4rem; font-weight: 800; color: var(--green-light); line-height: 1; }
.result-msg { color: var(--text-secondary); margin: 12px 0 28px; }

/* ---- PROGRESS ---- */
.progress-overview {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.prog-stat {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 24px; text-align: center;
}
.prog-stat-num { font-size: 2.2rem; font-weight: 800; color: var(--green-light); }
.prog-stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.progress-history { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 14px 20px;
}
.history-topic { font-weight: 600; font-size: 0.9rem; }
.history-score { color: var(--green-light); font-weight: 700; margin-left: auto; white-space: nowrap; }
.history-date { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }

/* ---- GRID NAV ---- */
.grid-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 0; border-top: 1px solid var(--border-color); margin-top: 32px;
}
.grid-nav a {
  color: var(--green-primary); text-decoration: none;
  font-weight: 600; font-size: 0.9rem; transition: var(--transition);
}
.grid-nav a:hover { color: var(--green-light); }

/* ---- KEY POINTS LIST ---- */
.key-points {
  list-style: none; padding: 0; margin: 12px 0;
  display: flex; flex-direction: column; gap: 8px;
}
.key-points li {
  padding: 8px 12px 8px 36px; position: relative;
  background: rgba(46,125,50,0.06); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.88rem; line-height: 1.6;
  border-left: 3px solid var(--green-primary);
}
.key-points li::before {
  content: '✓'; position: absolute; left: 10px; top: 8px;
  color: var(--green-light); font-weight: 700; font-size: 0.85rem;
}

/* ---- TOOL HEADER PARTS ---- */
.tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.tool-name { font-weight: 700; color: var(--green-light); font-size: 1.05rem; }
.tool-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-card); border: 1px solid var(--green-border);
  color: var(--text-primary); padding: 12px 20px;
  border-radius: var(--radius-sm); z-index: 9999;
  animation: slideIn 0.3s ease; box-shadow: var(--shadow);
}
@keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .options-grid { grid-template-columns: 1fr; }
  .controls-row { flex-direction: column; }
  .hero-stats { gap: 20px; }
  .hero { padding: 60px 16px; }
  .section { padding: 40px 16px; }
  .history-date { display: none; }
  .grid-nav { flex-direction: column; align-items: flex-start; gap: 8px; }
  #lessonTabs { padding: 0 16px; }
}
