/* ==========================================================================
   Estilos principales: Test auditivo y audiometría tonal (Fijate Tools)
   ========================================================================== */

:root {
  --primary: #ff8507;
  --primary-hover: #e07400;
  --primary-light: rgba(255, 133, 7, 0.12);
  --primary-glow: rgba(255, 133, 7, 0.35);

  --ear-left: #3b82f6;
  --ear-left-light: rgba(59, 130, 246, 0.15);
  --ear-right: #ef4444;
  --ear-right-light: rgba(239, 68, 68, 0.15);

  --success: #10b981;
  --success-hover: #059669;
  --success-light: rgba(16, 185, 129, 0.15);

  --bg-main: #0b0f17;
  --bg-card: #131b26;
  --bg-card-hover: #1a2434;
  --bg-input: #0e1520;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 133, 7, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(255, 133, 7, 0.6);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Cabecera estándar de la aplicación */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.btn-back-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-back-tools:hover {
  color: var(--text-main);
  border-color: var(--primary);
  transform: translateX(-2px);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #fbbf24);
  color: #0b0f17;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  margin: 0;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--text-main);
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

/* Contenedor principal */
.main-wrapper {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* Hero */
.tool-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.tool-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(255, 133, 7, 0.25);
}

.tool-hero h1 {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.tool-hero p {
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
  font-size: 0.98rem;
}

/* Tarjetas de pasos */
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  margin-bottom: 2rem;
  animation: fadeIn 0.3s ease;
}

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

.step-card-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.step-card-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.step-card-header p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Aviso de auriculares */
.headphone-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  color: #93c5fd;
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

/* Selector de modo */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.mode-choice-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.75rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mode-choice-card:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.mode-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.mode-choice-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.mode-choice-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex: 1;
}

/* Área activa del test */
.sound-stage {
  text-align: center;
  padding: 1.5rem 1rem;
}

.ear-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.ear-badge.ear-left {
  background: var(--ear-left-light);
  color: var(--ear-left);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.ear-badge.ear-right {
  background: var(--ear-right-light);
  color: var(--ear-right);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.freq-giant-display {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.vol-sub-display {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

/* Botón grande de reproducción */
.btn-play-tone {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #fbbf24);
  color: #0b0f17 !important;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--primary-glow);
  transition: all 0.2s ease;
  margin-bottom: 2rem;
}

.btn-play-tone:hover {
  transform: scale(1.04);
}

.btn-play-tone.pulse-anim {
  animation: audioPulse 0.7s infinite alternate ease-in-out;
}

@keyframes audioPulse {
  from { transform: scale(1); box-shadow: 0 0 16px var(--primary-glow); }
  to { transform: scale(1.08); box-shadow: 0 0 32px var(--primary-glow); }
}

/* Botones de respuesta */
.response-actions {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  max-width: 500px;
  margin: 0 auto;
}

.btn-hear-yes {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  background: var(--success);
  color: #ffffff;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px var(--success-light);
}

.btn-hear-yes:hover {
  background: var(--success-hover);
  transform: translateY(-1px);
}

.btn-hear-no {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-hear-no:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

/* Barra de progreso */
.progress-bar-container {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2rem;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.3s ease;
}

/* Gráfico de Audiograma SVG */
.audiogram-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.audiogram-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audiogram-svg {
  width: 100%;
  height: auto;
  display: block;
}

.audiogram-legend {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-circle.red {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--ear-right);
  display: inline-block;
}

.legend-cross.blue {
  color: var(--ear-left);
  font-weight: 800;
}

/* Resumen diagnóstico */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.diag-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}

.diag-pill .val {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.diag-pill .lbl {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.diag-text-box {
  background: rgba(255, 133, 7, 0.08);
  border: 1px solid rgba(255, 133, 7, 0.25);
  border-radius: 10px;
  padding: 1.25rem;
  color: var(--text-main);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* Resultados edad auditiva */
.age-result-banner {
  text-align: center;
  padding: 2.5rem;
}

.age-freq-big {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* Botones de acción final */
.results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  background: var(--primary);
  color: #0b0f17 !important;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  background: transparent;
  color: var(--text-main);
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Sección educativa */
.edu-section {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.edu-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
}

.edu-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edu-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
  .mode-grid, .diag-grid, .edu-section {
    grid-template-columns: 1fr;
  }
  .freq-giant-display {
    font-size: 2.2rem;
  }
}

/* @media print */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .tool-nav, .step-card-header button, .results-actions, .fijate-footer, .edu-section {
    display: none !important;
  }
  .main-wrapper {
    max-width: 100%;
    padding: 0;
  }
  .step-card {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .audiogram-card, .diag-pill {
    border: 1px solid #cccccc;
    background: #ffffff;
    color: #000000;
  }
}
