/* ==========================================================================
   Grade 7 Science ➔ WIDA 4.5 Bridge Studio Styles
   Educational Publisher Grade Design System
   ========================================================================== */

:root {
  --primary: #0f766e;
  --primary-dark: #0d5e58;
  --primary-light: #e6f6f5;
  --teal-glow: rgba(15, 118, 110, 0.2);
  --navy: #0e1e2e;
  --navy-card: #17283a;
  --navy-light: #243b53;
  --emerald: #10b981;
  --emerald-light: #ecfdf5;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --coral: #ea580c;
  --coral-light: #ffedd5;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --slate-text: #0f172a;
  --slate-muted: #64748b;
  --slate-subtle: #94a3b8;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px -8px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 20px rgba(15, 118, 110, 0.18);
  
  --font-heading: "Sora", "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, Monaco, monospace;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-canvas);
  color: var(--slate-text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ── */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

/* ── Top Navigation Bar ── */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--navy);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-badge .icon-box {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Hero Masthead ── */
.hero-card {
  background: linear-gradient(135deg, #0a192f 0%, #112240 50%, #0d3b36 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6ee7b7;
  margin-bottom: 12px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.hero-title span {
  color: #5eead4;
}

.hero-desc {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  max-width: 780px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.hero-meta-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 14px 20px;
}

.meta-item {
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  padding-left: 12px;
}

.meta-item.active-border {
  border-left-color: #5eead4;
}

.meta-item-val {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
}

.meta-item-val.green { color: #6ee7b7; }
.meta-item-val.amber { color: #fcd34d; }
.meta-item-val.cyan { color: #5eead4; }

.meta-item-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}

/* ── Ingestion Studio & Unit Presets ── */
.ingest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 960px) {
  .ingest-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--slate-muted);
  margin-top: 2px;
}

.preset-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.preset-btn {
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
  color: var(--slate-text);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.preset-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.preset-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px var(--teal-glow);
}

.preset-btn strong {
  font-family: var(--font-heading);
  font-size: 13px;
  color: var(--navy);
}

.preset-btn span {
  font-size: 11px;
  color: var(--slate-muted);
}

.textarea-field {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--slate-text);
  line-height: 1.5;
  resize: vertical;
  background: #ffffff;
  transition: border-color 0.15s ease;
}

.textarea-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

/* ── Linguistic Deconstruction Dashboard ── */
.lexicon-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

@media (max-width: 680px) {
  .lexicon-bar {
    grid-template-columns: 1fr;
  }
}

.lex-col {
  border-radius: var(--radius-sm);
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
}

.lex-col.t1 { border-top: 3px solid var(--blue); }
.lex-col.t2 { border-top: 3px solid var(--purple); }
.lex-col.t3 { border-top: 3px solid var(--primary); }

.lex-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.lex-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--slate-text);
  font-weight: 500;
}

.chip.t2 { background: var(--purple-light); color: var(--purple); border-color: rgba(124, 58, 237, 0.2); }
.chip.t3 { background: var(--primary-light); color: var(--primary-dark); border-color: rgba(15, 118, 110, 0.2); font-weight: 600; }

/* ── Tab Navigation ── */
.nav-tabs-wrapper {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(10px);
  padding: 12px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.nav-tabs {
  display: flex;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--slate-text);
  background: var(--bg-alt);
}

.tab-btn.active {
  background: var(--navy);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.tab-weight-badge {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.tab-btn:not(.active) .tab-weight-badge {
  background: var(--border);
  color: var(--slate-muted);
}

/* ── Tab Panels ── */
.tab-panel {
  display: none;
}

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

/* ── Writing Studio Specifics (35%) ── */
.upgrader-card {
  border-left: 4px solid var(--primary);
  margin-bottom: 18px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.upgrader-step {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.level-tag {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  height: fit-content;
  text-align: center;
}

.level-tag.l3 { background: var(--amber-light); color: var(--amber); }
.level-tag.l4 { background: var(--blue-light); color: var(--blue); }
.level-tag.l45 { background: var(--emerald-light); color: var(--emerald); font-size: 13px; font-weight: 800; }

.cer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin: 18px 0;
}

@media (max-width: 900px) {
  .cer-grid {
    grid-template-columns: 1fr;
  }
}

.cer-box {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.cer-box.claim { border-top: 4px solid var(--blue); }
.cer-box.evidence { border-top: 4px solid var(--amber); }
.cer-box.reasoning { border-top: 4px solid var(--emerald); }

.cer-header {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.cer-stem-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cer-stem-btn {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  text-align: left;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.12s ease;
  line-height: 1.4;
}

.cer-stem-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.rubric-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.rubric-meter {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border);
}

.meter-score {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
}

.meter-label {
  font-size: 11px;
  color: var(--slate-muted);
  margin-top: 2px;
}

/* ── Reading Studio Specifics (35%) ── */
.dual-reader {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 860px) {
  .dual-reader {
    grid-template-columns: 1fr;
  }
}

.reader-pane {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  font-size: 15px;
  line-height: 1.7;
}

.reader-pane.scaffolded {
  background: #fafcfb;
  border-color: rgba(15, 118, 110, 0.3);
}

.gloss-word {
  background: var(--amber-light);
  border-bottom: 2px dotted var(--amber);
  cursor: pointer;
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
  position: relative;
}

.gloss-word:hover {
  background: #fde68a;
}

/* ── Speaking Studio Specifics (15%) ── */
.recorder-card {
  background: var(--navy-card);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}

.waveform-canvas {
  width: 100%;
  height: 64px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  margin: 14px 0;
  display: block;
}

.recorder-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.record-btn {
  background: #ef4444;
  color: #ffffff;
  border: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  transition: all 0.15s ease;
}

.record-btn.recording {
  background: #ffffff;
  color: #ef4444;
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: #6ee7b7;
}

/* ── Listening Studio Specifics (15%) ── */
.listening-player {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.play-audio-btn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.play-audio-btn:hover {
  background: var(--primary-dark);
}

/* ── Reclassification Simulator & Archetypes ── */
.sim-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .sim-grid {
    grid-template-columns: 1fr;
  }
}

.slider-row {
  margin-bottom: 16px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.range-input {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.reclass-badge {
  display: inline-block;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 800;
  text-align: center;
  width: 100%;
  font-size: 1.25rem;
  margin-top: 14px;
}

.reclass-badge.met {
  background: var(--emerald-light);
  color: #065f46;
  border: 2px solid var(--emerald);
}

.reclass-badge.not-met {
  background: var(--amber-light);
  color: #92400e;
  border: 2px solid var(--amber);
}

/* ── Common Buttons & Utilities ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.14s ease;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-alt); color: var(--slate-text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-white { background: #fff; color: var(--navy); }
.btn-white:hover { background: #f8fafc; }

/* ── 8.5x11 Print Styling ── */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }
  .app-container {
    max-width: 100%;
    padding: 0;
  }
  .top-header, .nav-tabs-wrapper, .preset-buttons, .recorder-controls, .listening-player, .header-actions, .hero-card {
    display: none !important;
  }
  .tab-panel {
    display: block !important;
    page-break-after: always;
  }
  .card, .reader-pane, .upgrader-card {
    box-shadow: none !important;
    border: 1px solid #999 !important;
  }
  .print-only-header {
    display: block !important;
    border-bottom: 2px solid #000;
    margin-bottom: 15px;
    padding-bottom: 10px;
  }
}

.print-only-header {
  display: none;
}
