/*
 * components.css — Componentes reutilizáveis
 *
 * Instrumento: botões de simulação, sliders, HUD, sim-controls, toast
 * Caderno: exercícios, fases da lição, modo professor
 */

/* ═══════════════════════════════════════════════ *
 * Botões — instrumento
 * ═══════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-base);
  letter-spacing: 0.04em;
  border-radius: var(--radius-base);
  padding: var(--space-2) var(--space-5);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.btn--primary {
  background: var(--amber-dim);
  color: var(--amber-bright);
  border-color: var(--inst-border-amber);
}

.btn--primary:hover {
  background: var(--amber-glow);
  border-color: var(--amber);
}

.btn--secondary {
  background: var(--inst-bg-card);
  color: var(--inst-text-secondary);
  border-color: var(--inst-border-base);
}

.btn--secondary:hover {
  background: var(--inst-bg-hover);
  color: var(--inst-text-primary);
  border-color: var(--inst-border-mid);
}

.btn--sm {
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-3);
}

.btn-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Botões de simulação (play/pause/reset) ────── */

.sim-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-base);
  border: 1px solid var(--inst-border-base);
  background: var(--inst-bg-card);
  color: var(--inst-text-muted);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.sim-btn:hover {
  color: var(--amber);
  border-color: var(--inst-border-amber);
  background: var(--amber-dim);
}

.sim-btn.active {
  color: var(--amber-bright);
  border-color: var(--amber);
  background: var(--amber-dim);
  box-shadow: var(--shadow-amber-glow);
}

/* ═══════════════════════════════════════════════ *
 * Controles de parâmetros — instrumento
 * ═══════════════════════════════════════════════ */

.control-group {
  margin-bottom: var(--space-5);
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-2);
}

/* Label da grandeza — EB Garamond, não mono */
.control-label__name {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--inst-text-secondary);
  letter-spacing: 0.01em;
}

/* Valor atual — mono, âmbar */
.control-label__value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--amber);
  letter-spacing: 0.05em;
}

.control-label__unit {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--inst-text-muted);
  margin-left: 3px;
}

/* Slider — aparência de potenciômetro de instrumento */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--inst-border-base);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

input[type="range"]:hover {
  background: var(--inst-border-mid);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--inst-bg-primary);
  box-shadow: 0 0 0 1px var(--amber), var(--shadow-amber-glow);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--inst-bg-primary);
  box-shadow: 0 0 0 1px var(--amber);
  cursor: pointer;
}

/* ── Toggle ────────────────────────────────────── */

.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--inst-text-secondary);
}

.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle__track {
  position: absolute;
  inset: 0;
  background: var(--inst-border-mid);
  border-radius: 10px;
  transition: background var(--transition-fast);
  cursor: pointer;
}

.toggle__track::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: var(--inst-text-muted);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle input:checked + .toggle__track {
  background: var(--amber-dim);
  border: 1px solid var(--inst-border-amber);
}

.toggle input:checked + .toggle__track::before {
  transform: translateX(16px);
  background: var(--amber);
  box-shadow: var(--shadow-amber-glow);
}

/* ═══════════════════════════════════════════════ *
 * HUD — leituras numéricas do instrumento
 *
 * Share Tech Mono. Amarelo âmbar.
 * Como o display de um voltímetro analógico.
 * ═══════════════════════════════════════════════ */

.hud-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.hud-item__sym {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-xs);
  color: var(--inst-text-muted);
  min-width: 20px;
}

.hud-item__val {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--amber);
  letter-spacing: 0.08em;
}

.hud-item__unit {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--inst-text-muted);
}

/* ═══════════════════════════════════════════════ *
 * Exercícios — caderno
 * ═══════════════════════════════════════════════ */

.exercise-block {
  background: var(--nb-bg);
  border: 1px solid var(--nb-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-nb-card);
}

.exercise-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: var(--nb-bg-card);
  border-bottom: 1px solid var(--nb-border);
}

.exercise-block__num {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nb-text-muted);
}

.exercise-block__type {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--nb-text-muted);
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.exercise-block__body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.exercise-block__question {
  font-family: var(--font-body);
  font-size: var(--text-md);
  color: var(--nb-text-primary);
  line-height: 1.75;
  margin-bottom: 0;
}

/* Opções de múltipla escolha */
.exercise-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.exercise-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--nb-bg-card);
  border: 1px solid var(--nb-border);
  border-radius: var(--radius-base);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--nb-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.exercise-option:hover {
  background: var(--nb-bg-inset);
  border-color: var(--nb-blue);
  color: var(--nb-text-primary);
}

.exercise-option.correct {
  background: rgba(61, 122, 85, 0.10);
  border-color: #3d7a55;
  color: #2a5c3a;
}

.exercise-option.wrong {
  background: rgba(181, 74, 40, 0.10);
  border-color: #b54a28;
  color: #8a3018;
}

/* Dica e explicação */
.exercise-hint-btn {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--nb-text-muted);
  border: 1px solid var(--nb-border-dim);
  border-radius: var(--radius-base);
  padding: var(--space-1) var(--space-3);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.exercise-hint-btn:hover {
  color: var(--nb-blue);
  border-color: var(--nb-blue);
  background: var(--nb-blue-dim);
}

.exercise-hint {
  background: var(--nb-bg-inset);
  border: 1px solid var(--nb-border);
  border-left: 3px solid var(--nb-text-muted);
  border-radius: 0 var(--radius-base) var(--radius-base) 0;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--nb-text-secondary);
  line-height: 1.65;
}

.exercise-explanation {
  background: rgba(44, 74, 124, 0.06);
  border: 1px solid rgba(44, 74, 124, 0.20);
  border-radius: var(--radius-base);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--nb-text-secondary);
  line-height: 1.65;
}

/* ═══════════════════════════════════════════════ *
 * Modo professor — caderno
 * ═══════════════════════════════════════════════ */

.teacher-panel {
  background: var(--nb-bg);
  border: 1px solid var(--nb-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-nb-card);
}

.teacher-panel__header {
  padding: var(--space-3) var(--space-5);
  background: var(--nb-bg-card);
  border-bottom: 1px solid var(--nb-border);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nb-text-muted);
}

.teacher-panel__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-5);
  border-bottom: 1px solid var(--nb-border-dim);
  font-size: var(--text-sm);
}

.teacher-panel__row:last-child {
  border-bottom: none;
}

.teacher-panel__key {
  font-family: var(--font-body);
  color: var(--nb-text-muted);
  flex-shrink: 0;
}

.teacher-panel__val {
  font-family: var(--font-body);
  color: var(--nb-text-secondary);
  text-align: right;
}

/* ═══════════════════════════════════════════════ *
 * Toast — instrumento
 * ═══════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--inst-bg-panel);
  border: 1px solid var(--inst-border-mid);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--inst-text-secondary);
  box-shadow: var(--shadow-panel);
  pointer-events: auto;
  max-width: 320px;
  animation: toast-in var(--transition-base) ease;
}

.toast--amber { border-left: 2px solid var(--amber); }
.toast--green { border-left: 2px solid var(--vec-kinetic); }
.toast--red   { border-left: 2px solid var(--vec-force); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
