/* Styles for Lesson 07: How EMF Works */

:root {
  --ink: #152239;
  --muted: #586579;
  --blue: #235ad3;
  --lime: #a8f074;
  --line: #dce2e9;
  --paper: #f5f7f9;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --radius: 12px;
}

/* Tabs */
.lesson-tabs {
  display: flex;
  gap: 10px;
  margin: 24px 0 16px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.tab-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.tab-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.lesson-panel {
  margin-top: 10px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.panel-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-top: -6px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.formula-chip {
  display: inline-block;
  background: #edf2fc;
  color: var(--blue);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: monospace;
}

/* Chapter 0: Spectrum Nav */
.spectrum-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.spec-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
}

.spec-btn:hover {
  border-color: var(--blue);
}

.spec-btn.active {
  background: #edf2fc;
  border-color: var(--blue);
  outline: 2px solid var(--blue);
}

.spec-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.spec-sub {
  font-size: 11px;
  color: var(--muted);
}

.spec-btn.danger-band.active {
  background: #fef2f2;
  border-color: var(--accent-red);
  outline: 2px solid var(--accent-red);
}

.spec-display {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
  transition: opacity 0.2s ease;
}

.spec-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.tag-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--blue);
}

.spec-display h3 {
  margin: 4px 0 0;
  font-size: 20px;
  color: var(--ink);
}

.spec-meta-badge {
  background: #e6f7df;
  color: #1b6321;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.spec-meta-badge.danger {
  background: #fee2e2;
  color: #991b1b;
}

.spec-grid-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.info-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cell-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.info-cell strong {
  font-size: 15px;
  color: var(--ink);
}

.info-cell small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.key-takeaway-box {
  background: #f0f7ff;
  border-left: 4px solid var(--blue);
  padding: 14px 18px;
  border-radius: 6px;
  font-size: 14px;
  color: #1e3a8a;
  line-height: 1.6;
}

/* Chapter 1: Distance Simulator */
.distance-sim-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.slider-control-group {
  background: var(--paper);
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.slider-control-group label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 15px;
}

.dist-highlight {
  color: var(--blue);
  font-weight: 800;
  font-size: 17px;
}

input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #cbd5e1;
  outline: none;
  cursor: pointer;
  accent-color: var(--blue);
}

.range-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.sim-stage {
  position: relative;
  height: 220px;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 40px;
}

.sim-emitter {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
}

.emitter-icon {
  font-size: 34px;
  background: #1e293b;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--blue);
  box-shadow: 0 0 15px rgba(35, 90, 211, 0.4);
}

.emitter-label {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  text-transform: uppercase;
}

.pulse-ring {
  position: absolute;
  left: 30px;
  top: 30px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(59, 130, 246, 0.7);
  transform: translate(-50%, -50%);
  animation: pulse-out 2s infinite ease-out;
  pointer-events: none;
}

@keyframes pulse-out {
  0% {
    width: 20px;
    height: 20px;
    opacity: 0.9;
  }
  100% {
    width: 400px;
    height: 400px;
    opacity: 0;
  }
}

.sim-meter {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: left 0.15s ease-out;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.meter-box {
  background: #ffffff;
  border: 2px solid #334155;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  width: 140px;
}

.meter-label-sm {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #64748b;
  display: block;
}

.meter-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin: 4px 0 6px;
}

.meter-bar-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.meter-bar-fill {
  height: 100%;
  background: var(--blue);
  transition: width 0.15s ease-out, background-color 0.2s;
}

.meter-caption {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.85);
  padding: 2px 8px;
  border-radius: 4px;
}

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

.calc-box {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
}

.calc-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  display: block;
  text-transform: uppercase;
}

.calc-stat {
  font-size: 22px;
  font-weight: 800;
  color: var(--blue);
  margin: 4px 0 2px;
  display: block;
}

.calc-box small {
  font-size: 12px;
  color: var(--muted);
}

/* Chapter 2: Waves */
.wave-toggle-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.wave-mode-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wave-mode-btn.active {
  background: #edf2fc;
  border-color: var(--blue);
  outline: 2px solid var(--blue);
}

.wave-mode-btn strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
}

.wave-mode-btn span {
  font-size: 12px;
  color: var(--muted);
}

.wave-visualizer-card {
  background: #0f172a;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.wave-canvas-wrapper {
  height: 160px;
  width: 100%;
}

.wave-canvas-wrapper svg {
  width: 100%;
  height: 100%;
}

.wave-legend {
  display: flex;
  gap: 24px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #1e293b;
  color: #cbd5e1;
  font-size: 13px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-indicator {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-indicator.peak-ind {
  background: #3b82f6;
}

.legend-indicator.avg-ind {
  background: #10b981;
}

.details-accordion details {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 10px;
}

.details-accordion summary {
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
}

.details-accordion p {
  margin: 10px 0 4px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* Chapter 3: Quiz */
.quiz-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  background: var(--paper);
}

.quiz-question {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 12px;
  padding: 0 6px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
}

.check input {
  margin-top: 4px;
}

.quiz-feedback {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}

.quiz-feedback.success {
  background: #e6f7df;
  border: 1px solid #a3e635;
  color: #1b6321;
}

.quiz-feedback.retry {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.complete-card {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 24px;
  margin-top: 20px;
}

.complete-card h3 {
  margin: 0 0 8px;
  color: var(--blue);
}

.next-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Lesson Navigation Controls */
.lesson-nav-controls {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.transcript-details {
  margin-top: 30px;
}

.transcript-content {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}

/* Responsive */
@media (max-width: 800px) {
  .lesson-panel {
    padding: 20px 16px;
  }
  .spec-grid-info, .calc-results-grid, .wave-toggle-group {
    grid-template-columns: 1fr;
  }
  .sim-stage {
    padding: 0 10px;
    height: 200px;
  }
  .sim-emitter {
    left: 10px;
  }
  .meter-box {
    width: 110px;
    padding: 8px 10px;
  }
  .meter-value {
    font-size: 16px;
  }
}
