/* ================================================================
   CNA Study Guide — App Styles
   Clean, medical-professional aesthetic
   ================================================================ */

/* ── Variables ── */
:root {
  --cat-red:    #DC2626;
  --cat-blue:   #2563EB;
  --cat-green:  #16A34A;
  --cat-yellow: #D97706;
  --cat-purple: #7C3AED;
  --bg:         #F8FAFC;
  --surface:    #FFFFFF;
  --border:     #E2E8F0;
  --text:       #1E293B;
  --text-muted: #64748B;
  --radius:     12px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --font-sans:  'Inter', system-ui, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Navigation ── */
#main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 56px;
  box-shadow: var(--shadow);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--cat-blue);
  padding-right: 24px;
  border-right: 1px solid var(--border);
  margin-right: 8px;
  white-space: nowrap;
}

.brand-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  background: none;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.tab-btn:hover { background: var(--bg); color: var(--text); }
.tab-btn.active {
  background: var(--cat-blue);
  color: #fff;
  font-weight: 600;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.xp-badge, .streak-badge {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
}

#xp-count, #streak-count { font-variant-numeric: tabular-nums; }

.btn-tier {
  background: var(--cat-blue);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-tier.unlocked { background: #16A34A; }
.btn-tier:hover { opacity: 0.9; }

/* ── Progress Bar ── */
.progress-bar-wrap {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px;
}

.progress-bar-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cat-blue), #60A5FA);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Tab Content ── */
.tab-content {
  display: none;
  padding: 24px 20px;
  max-width: 900px;
  margin: 0 auto;
}

.tab-content.active { display: block; }

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.section-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ── Category Badges ── */
.cat-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cat-red    { background: #FEF2F2; color: var(--cat-red);    border: 1px solid #FECACA; }
.cat-blue   { background: #EFF6FF; color: var(--cat-blue);   border: 1px solid #BFDBFE; }
.cat-green  { background: #F0FDF4; color: var(--cat-green);  border: 1px solid #BBF7D0; }
.cat-yellow { background: #FFFBEB; color: var(--cat-yellow); border: 1px solid #FDE68A; }
.cat-purple { background: #F5F3FF; color: var(--cat-purple); border: 1px solid #DDD6FE; }

/* ── Buttons ── */
.btn-primary {
  background: var(--cat-blue);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover { background: #1D4ED8; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-secondary:hover { border-color: var(--cat-blue); color: var(--cat-blue); }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }

/* ── Quiz ── */
.quiz-start {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.quiz-meta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 20px 0 28px;
  flex-wrap: wrap;
}

.meta-pill {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Question Card ── */
.question-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.q-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.q-num { font-size: 12px; color: var(--text-muted); font-weight: 500; }

.q-text {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
}

.answers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.answer-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--cat-blue);
  background: #EFF6FF;
}

.answer-btn.correct { background: #DCFCE7; border-color: #16A34A; color: #14532D; font-weight: 600; }
.answer-btn.incorrect { background: #FEE2E2; border-color: #DC2626; color: #7F1D1D; }

/* ── Feedback Box ── */
.feedback-box {
  padding: 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.feedback-correct { background: #F0FDF4; border: 1px solid #BBF7D0; color: #14532D; }
.feedback-incorrect { background: #FEF2F2; border: 1px solid #FECACA; color: #7F1D1D; }
.feedback-box em { color: var(--text-muted); font-size: 13px; display: block; margin-top: 6px; }

/* ── Question Navigation ── */
.q-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.q-nav button { min-width: 100px; }

/* ── Quiz Score Bar ── */
.quiz-score-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 20px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

.quiz-score-bar strong { color: var(--cat-blue); }

/* ── Quiz Results ── */
.quiz-results {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.results-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 24px 0;
}

.results-score {
  font-size: 56px;
  font-weight: 800;
  color: var(--cat-blue);
  line-height: 1;
}

.results-pct {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-muted);
}

#results-msg { font-size: 16px; color: var(--text-muted); margin-bottom: 24px; }

/* ── Flashcards ── */
.flash-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.filter-btn.active {
  background: var(--cat-blue);
  color: #fff;
  border-color: var(--cat-blue);
}

.flash-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.flash-stat { display: flex; gap: 6px; align-items: center; }
.flash-stat-num { font-weight: 700; color: var(--cat-blue); }

.flashcards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ── Individual Flashcard ── */
.flashcard {
  perspective: 1000px;
  cursor: pointer;
}

.fc-inner {
  position: relative;
  height: 180px;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}

.fc-inner.flipped { transform: rotateY(180deg); }

.fc-front, .fc-back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 16px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.fc-front {
  background: var(--surface);
}

.fc-back {
  background: #F8FAFC;
  transform: rotateY(180deg);
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
}

.fc-front p, .fc-back p {
  font-size: 13px;
  line-height: 1.5;
}

.fc-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.fc-got, .fc-review {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.15s;
}

.fc-got:hover, .fc-review:hover { border-color: var(--cat-blue); color: var(--cat-blue); }
.fc-got.marked { background: #DCFCE7; border-color: #16A34A; color: #14532D; }
.fc-review.marked { background: #FFF7ED; border-color: #D97706; color: #92400E; }

/* ── Skills ── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.skill-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.skill-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.skill-icon { font-size: 24px; }

.skill-header h3 {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}

.skill-steps { padding: 12px 16px; }

.step {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 12.5px;
}

.step:last-child { border-bottom: none; }

.step-n {
  min-width: 20px;
  height: 20px;
  background: var(--cat-blue);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-t { line-height: 1.5; }

.skill-extra {
  padding: 12px 16px;
  background: #F8FAFC;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.skill-kp, .skill-mistakes { margin-bottom: 10px; }
.skill-kp ul, .skill-mistakes ul { padding-left: 20px; margin-top: 4px; }
.skill-mistakes li { color: #B91C1C; }

.skill-toggle {
  width: 100%;
  border: none;
  border-top: 1px solid var(--border);
  background: var(--bg);
  color: var(--cat-blue);
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}

.skill-toggle:hover { background: #EFF6FF; }

/* ── Review ── */
.review-sections { display: flex; flex-direction: column; gap: 20px; }

.review-block {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.review-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
}

.review-icon { font-size: 22px; }

.review-body {
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.7;
}

.review-body p { margin-bottom: 12px; color: var(--text); }
.review-body h4 { font-size: 14px; font-weight: 700; margin: 16px 0 8px; color: var(--text); }

.must-know {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
}

.must-know strong {
  display: block;
  color: #14532D;
  font-size: 13px;
  margin-bottom: 8px;
}

.must-know ul { padding-left: 20px; }
.must-know li { font-size: 13px; color: #14532D; margin-bottom: 4px; }

/* ── PDF Tab ── */
.pdf-preview-placeholder {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
}

.pdf-icon-lg { font-size: 64px; margin-bottom: 16px; }
.pdf-preview-placeholder p { color: var(--text-muted); margin-bottom: 12px; font-size: 15px; }

.pdf-info-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.pdf-info-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.pdf-info-box p { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }

.pdf-checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pdf-checklist li {
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Pricing Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px;
  max-width: 780px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,.1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
}

.modal-close:hover { background: var(--bg); }

.modal-sm { max-width: 380px; text-align: center; padding: 28px; }

.pricing-header { text-align: center; margin-bottom: 28px; }
.pricing-header h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.pricing-header p { color: var(--text-muted); font-size: 14px; }

.pricing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.pricing-card {
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pricing-card:hover { border-color: #93C5FD; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1); }

.pricing-card.featured {
  border-color: var(--cat-blue);
  background: #F0F6FF;
}

.pc-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
}

.pc-tag-accent { background: #EFF6FF; color: var(--cat-blue); border-color: #BFDBFE; }

.pc-price {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.pc-period { font-size: 16px; font-weight: 400; color: var(--text-muted); }
.pc-onetime { font-size: 11px; color: var(--cat-green); font-weight: 600; }

.pc-features { list-style: none; padding: 0; text-align: left; font-size: 13px; }
.pc-features li { padding: 4px 0; }
.pc-features .fa { color: var(--cat-green); }

/* PDF Progress */
.pdf-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0 12px;
}

.pdf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cat-blue), #60A5FA);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav-brand span:not(.brand-icon) { display: none; }
  .tab-btn { padding: 5px 10px; font-size: 12px; }
  .pricing-cards { grid-template-columns: 1fr; }
  .pdf-checklist { grid-template-columns: 1fr; }
  .flashcards-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
}