/* NEC Learning App — The Journeyman Blueprint */

:root {
  --primary: #F59E0B;
  --primary-dark: #D97706;
  --bg: #0F172A;
  --surface: #1E293B;
  --surface2: #273448;
  --border: #334155;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --green: #10B981;
  --red: #EF4444;
  --nav-height: 64px;
  --header-height: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

#app { position: relative; min-height: 100vh; }

/* Views */
.view { display: none; min-height: 100vh; padding-bottom: calc(var(--nav-height) + 16px); }
.view.active { display: block; }

/* Header */
.view-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.view-title { font-size: 20px; font-weight: 700; }
.card-counter { font-size: 14px; color: var(--text-muted); font-weight: 600; }

/* Bottom Nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 8px 4px; transition: color 0.2s;
}
.nav-btn.active { color: var(--primary); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 10px; font-weight: 600; }

/* Home */
.header-top { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; }
.app-title { font-size: 20px; font-weight: 800; }
.app-subtitle { font-size: 12px; color: var(--text-muted); }

.pro-badge {
  background: var(--primary); color: #000; font-size: 11px; font-weight: 800;
  padding: 3px 8px; border-radius: 20px;
}
.upgrade-btn-sm {
  background: var(--primary); color: #000; font-size: 12px; font-weight: 700;
  padding: 6px 14px; border: none; border-radius: 20px; cursor: pointer;
}

.home-content { padding: 16px; }

.streak-card {
  background: linear-gradient(135deg, #1E293B, #273448);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px;
}
.streak-icon { font-size: 36px; }
.streak-num { font-size: 32px; font-weight: 800; color: var(--primary); }
.streak-label { font-size: 12px; color: var(--text-muted); }

.section-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }

.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; cursor: pointer; transition: border-color 0.2s, transform 0.1s;
}
.tile:active { transform: scale(0.97); }
.tile:hover { border-color: var(--primary); }
.tile-icon { font-size: 28px; margin-bottom: 8px; }
.tile-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.tile-sub { font-size: 12px; color: var(--text-muted); }

.upgrade-card {
  background: linear-gradient(135deg, #1a1200, #2d1f00);
  border: 1px solid var(--primary-dark);
  border-radius: 16px; padding: 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; margin-top: 8px;
}
.upgrade-card-icon { font-size: 24px; }
.upgrade-card-title { font-size: 14px; font-weight: 700; color: var(--primary); }
.upgrade-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.upgrade-arrow { font-size: 24px; color: var(--primary); margin-left: auto; }

/* Flashcards */
.filter-row {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  white-space: nowrap; padding: 6px 14px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.filter-chip.active { background: var(--primary); color: #000; border-color: var(--primary); font-weight: 700; }

.flashcard-area { padding: 16px; min-height: 280px; display: flex; align-items: center; justify-content: center; }

.flashcard {
  width: 100%; min-height: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 24px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: center;
  transition: transform 0.3s; position: relative;
}
.flashcard.flipped { background: var(--surface2); border-color: var(--primary); }
.card-tag { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }
.card-text { font-size: 17px; line-height: 1.6; }
.card-hint { font-size: 12px; color: var(--text-muted); margin-top: 16px; text-align: center; }
.card-back .card-text { color: var(--primary); }

.card-nav { display: flex; gap: 12px; padding: 0 16px 16px; }
.card-nav-btn {
  flex: 1; padding: 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer;
}
.card-nav-btn.primary { background: var(--primary); color: #000; border-color: var(--primary); }

.pro-nudge {
  margin: 0 16px 16px; padding: 14px; background: var(--surface);
  border: 1px dashed var(--primary); border-radius: 12px;
  text-align: center; color: var(--primary); font-size: 14px; cursor: pointer;
}

/* Quiz */
.quiz-list { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.quiz-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; display: flex; align-items: center; cursor: pointer; transition: border-color 0.2s;
}
.quiz-card:hover { border-color: var(--primary); }
.quiz-card.locked { opacity: 0.7; }
.quiz-card-info { flex: 1; }
.quiz-card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.quiz-card-sub { font-size: 13px; color: var(--text-muted); }
.quiz-score { font-size: 12px; color: var(--primary); margin-top: 4px; font-weight: 600; }
.quiz-arrow { font-size: 24px; color: var(--text-muted); margin-left: 8px; }

.quiz-progress-bar { height: 4px; background: var(--surface); margin: 0 16px 8px; border-radius: 2px; }
.quiz-progress-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.3s; }

.quiz-question-area { padding: 16px; }
.quiz-q { font-size: 18px; font-weight: 600; line-height: 1.5; margin-bottom: 20px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: 15px; text-align: left; cursor: pointer; transition: all 0.2s;
}
.quiz-option:hover:not(:disabled) { border-color: var(--primary); }
.quiz-option.correct { background: #0f3d2e; border-color: var(--green); color: var(--green); }
.quiz-option.wrong { background: #3d0f0f; border-color: var(--red); color: var(--red); }
.quiz-ref { font-size: 12px; color: var(--text-muted); margin-top: 16px; }

.quiz-result { padding: 16px; text-align: center; }
.result-score { font-size: 72px; font-weight: 900; }
.result-score.pass { color: var(--green); }
.result-score.fail { color: var(--red); }
.result-label { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.result-detail { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.result-review { text-align: left; margin-bottom: 24px; display: flex; flex-direction: column; gap: 8px; }
.review-item { padding: 12px; border-radius: 10px; font-size: 14px; }
.review-item.correct { background: #0f3d2e; border: 1px solid var(--green); }
.review-item.wrong { background: #3d0f0f; border: 1px solid var(--red); }
.review-q { font-weight: 600; margin-bottom: 4px; }
.review-a { color: var(--text-muted); }
.review-ref { font-size: 11px; }

/* Changes */
.changes-list { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.change-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; cursor: pointer; }
.change-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; }
.change-section { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.06em; }
.change-title { font-size: 16px; font-weight: 700; margin-top: 4px; }
.change-arrow { font-size: 20px; color: var(--text-muted); transition: transform 0.2s; }
.change-body { display: none; padding: 0 16px 16px; border-top: 1px solid var(--border); }
.change-card.expanded .change-body { display: block; }
.change-card.expanded .change-arrow { transform: rotate(90deg); }
.change-summary { font-size: 14px; line-height: 1.6; margin: 12px 0; }
.change-compare { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.change-before { background: #3d1f0f; border-radius: 8px; padding: 10px; font-size: 13px; line-height: 1.5; }
.change-after { background: #0f3d1f; border-radius: 8px; padding: 10px; font-size: 13px; line-height: 1.5; }
.change-impact { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.locked-card {
  background: var(--surface); border: 1px dashed var(--primary); border-radius: 16px;
  padding: 20px; text-align: center; cursor: pointer; color: var(--primary);
}
.locked-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Progress */
.progress-content { padding: 16px; }
.progress-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.progress-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; text-align: center; }
.stat-num { font-size: 32px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.score-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.score-name { font-size: 13px; font-weight: 600; width: 120px; flex-shrink: 0; }
.score-bar-wrap { flex: 1; height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.score-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.5s; }
.score-pct { font-size: 13px; font-weight: 700; width: 38px; text-align: right; }
.score-pct.pass { color: var(--green); }
.score-pct.fail { color: var(--red); }

/* Upgrade */
.upgrade-content { padding: 16px; }
.upgrade-hero { text-align: center; padding: 24px 0; }
.upgrade-hero-title { font-size: 28px; font-weight: 900; color: var(--primary); }
.upgrade-hero-sub { font-size: 16px; color: var(--text-muted); margin-top: 8px; }

.pricing-card {
  background: linear-gradient(135deg, #1a1200, #2d1f00);
  border: 1px solid var(--primary);
  border-radius: 20px; padding: 24px; margin-bottom: 20px;
}
.price-amount { font-size: 48px; font-weight: 900; color: var(--primary); }
.price-amount span { font-size: 20px; font-weight: 400; color: var(--text-muted); }
.price-alt { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }

.feature-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.feature-list li { font-size: 15px; }
.feature-list.muted li { color: var(--text-muted); font-size: 14px; }

.btn-primary {
  width: 100%; padding: 16px; background: var(--primary); color: #000;
  font-size: 16px; font-weight: 800; border: none; border-radius: 14px; cursor: pointer;
}
.btn-primary.btn-big { font-size: 18px; padding: 18px; }
.price-note { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 12px; }

.free-features { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.free-title { font-size: 14px; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; }

.btn-danger {
  width: 100%; padding: 14px; background: transparent; color: var(--red);
  border: 1px solid var(--red); border-radius: 12px; font-size: 14px; cursor: pointer; margin-top: 24px;
}

.empty-state { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 15px; line-height: 1.6; }
