/**
 * Estilos Canónicos: Calculadora de ritmo de carrera, tiempos de paso y splits para runners
 * Fijate Tools • Suite Canónica de Herramientas Web
 */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta cromática HSL modo oscuro (predeterminado) */
  --bg-primary: #0b0f17;
  --bg-secondary: #111827;
  --bg-surface: #1a2234;
  --bg-surface-hover: #222d42;
  --bg-card: #151d2d;
  --border-subtle: #243048;
  --border-focus: #3b82f6;

  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #8392a8; /* Contraste óptimo verificado sobre fondo oscuro */
  --text-inverse: #0b0f17;

  /* Acentos de carrera y atletismo */
  --accent-primary: #0ea5e9;
  --accent-hover: #0284c7;
  --accent-light: rgba(14, 165, 233, 0.14);
  --accent-glow: rgba(14, 165, 233, 0.35);

  --accent-success: #10b981;
  --accent-success-bg: rgba(16, 185, 129, 0.14);
  --accent-warning: #f59e0b;
  --accent-warning-bg: rgba(245, 158, 11, 0.14);
  --accent-danger: #ef4444;
  --accent-danger-bg: rgba(239, 68, 68, 0.14);
  --accent-purple: #8b5cf6;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.45);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f8fafc;
  --bg-card: #ffffff;
  --border-subtle: #e2e8f0;
  --border-focus: #0284c7;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #52637a; /* Contraste óptimo > 4.5:1 en fondo claro */
  --text-inverse: #ffffff;

  --accent-primary: #0284c7;
  --accent-hover: #0369a1;
  --accent-light: rgba(2, 132, 199, 0.08);
  --accent-glow: rgba(2, 132, 199, 0.2);

  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
}

/* Reglas estructurales base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title {
  font-family: var(--font-heading);
  letter-spacing: -0.015em;
  font-weight: 700;
  color: var(--text-main);
}

.mono {
  font-family: var(--font-mono);
}

/* Layout y cuadrícula de la suite */
.main-wrapper.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3.5rem;
  padding: 0 1rem;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Tarjeta contenedora de la herramienta */
.tool-card-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-top: 1rem;
}

/* Selector superior de modos de cálculo (Tabs) */
.calc-mode-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  background: var(--bg-surface);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  min-height: 42px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.mode-tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Presets rápidos de distancias */
.dist-presets-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed var(--border-subtle);
}

.preset-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn-preset {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-preset:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--accent-primary);
}

.btn-preset.active {
  background: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  font-weight: 700;
}

/* Formulario interactivo */
.pace-form {
  margin-bottom: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.form-group-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition-fast);
}

.form-group-card.is-target {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.field-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.85rem;
}

.field-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 800;
}

/* Inputs de control táctiles */
.form-control {
  height: 44px;
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control.disabled,
.form-control:disabled {
  opacity: 0.65;
  background: var(--bg-secondary);
  cursor: not-allowed;
}

.input-unit-flex {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.input-unit-flex .form-control {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
}

.form-select-unit {
  width: 135px;
  max-width: 135px;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 0.5rem 1.75rem 0.5rem 0.75rem;
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  appearance: none;
}

.form-select-canonic {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 0.5rem 2.25rem 0.5rem 0.85rem;
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  appearance: none;
}

/* Flex para inputs de tiempo HH:MM:SS */
.time-inputs-flex {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.time-col {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.time-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  text-align: center;
}

.time-col .form-control {
  text-align: center;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.time-sep {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-top: 1.1rem;
}

/* Grupo de ritmo y velocidad auxiliar */
.pace-inputs-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pace-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.unit-tag-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 1.1rem;
  white-space: nowrap;
  padding: 0 0.25rem;
}

.speed-inline-aux {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dotted var(--border-subtle);
}

.speed-aux-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.speed-input-flex {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 130px;
}

.speed-input-flex .form-control {
  height: 36px;
  min-height: 36px;
  padding: 0.25rem 0.5rem;
  text-align: center;
}

.speed-input-flex .unit-tag-badge {
  margin-top: 0;
}

.helper-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.65rem;
  line-height: 1.35;
}

/* Botonera de acciones */
.form-actions-row {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 44px;
  min-height: 44px;
  padding: 0 1.25rem;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary-action:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 44px;
  min-height: 44px;
  padding: 0 1rem;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary-action:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

/* Tarjetas resumen de resultados (Hero stats) */
.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2.25rem;
}

.hero-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.hero-stat-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.hero-stat-card.highlight {
  border-color: var(--accent-primary);
  background: linear-gradient(145deg, var(--bg-surface) 0%, rgba(14, 165, 233, 0.08) 100%);
}

.stat-caption {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-value-box {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.hero-stat-card.highlight .stat-number {
  color: var(--accent-primary);
}

.stat-unit {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Estrategia de carrera y splits */
.splits-strategy-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  max-width: 680px;
}

.split-controls-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn-split-strat {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 38px;
  transition: all var(--transition-fast);
}

.btn-split-strat:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--accent-primary);
}

.btn-split-strat.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 6px var(--accent-glow);
}

.strategy-details-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
}

.strategy-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.strategy-k {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.strategy-v {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Barra de herramientas de la tabla de paso */
.splits-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.table-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.table-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.table-counter {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-primary);
  background: var(--accent-light);
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-tool-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 38px;
  transition: all var(--transition-fast);
}

.btn-tool-action:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-tool-action.highlight {
  background: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-tool-action.highlight:hover {
  background: var(--accent-primary);
  color: #ffffff;
}

/* Tabla responsiva y filas de splits */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  max-height: 520px;
  overflow-y: auto;
}

.splits-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.splits-table th {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-subtle);
  z-index: 2;
  white-space: nowrap;
}

.splits-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  white-space: nowrap;
}

.splits-table tbody tr:hover {
  background: var(--bg-surface-hover);
}

.splits-table tr.milestone-5k {
  background: rgba(14, 165, 233, 0.05);
}

.splits-table tr.milestone-half {
  background: rgba(139, 92, 246, 0.08);
  font-weight: 600;
}

.splits-table tr.milestone-finish {
  background: rgba(16, 185, 129, 0.1);
  font-weight: 700;
}

.col-km {
  font-weight: 700;
  color: var(--accent-primary);
}

.diff-tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.diff-tag.faster {
  color: var(--accent-success);
  background: var(--accent-success-bg);
}

.diff-tag.slower {
  color: var(--accent-warning);
  background: var(--accent-warning-bg);
}

.diff-tag.equal {
  color: var(--text-muted);
}

.milestone-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.milestone-badge.water {
  border-color: rgba(14, 165, 233, 0.4);
  color: var(--accent-primary);
}

.milestone-badge.gel {
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--accent-warning);
}

.milestone-badge.wall {
  border-color: rgba(239, 68, 68, 0.5);
  color: var(--accent-danger);
  font-weight: 700;
}

.milestone-badge.finish {
  border-color: rgba(16, 185, 129, 0.5);
  color: var(--accent-success);
  font-weight: 700;
}

/* Bloque Riegel: Predicción de marcas */
.riegel-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.riegel-factor-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 320px;
}

.riegel-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.riegel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.riegel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

.riegel-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.riegel-card.is-base {
  border-color: var(--accent-success);
  background: linear-gradient(145deg, var(--bg-card) 0%, rgba(16, 185, 129, 0.06) 100%);
}

.riegel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.riegel-dist-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.riegel-status-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.riegel-card.is-base .riegel-status-tag {
  background: var(--accent-success-bg);
  border-color: var(--accent-success);
  color: var(--accent-success);
}

.riegel-time {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.riegel-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border-subtle);
}

.btn-load-riegel {
  margin-top: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 36px;
  transition: all var(--transition-fast);
}

.btn-load-riegel:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* Zonas de entrenamiento fisiológico */
.zones-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.zones-table-responsive {
  width: 100%;
  overflow-x: auto;
}

.zones-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.zones-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}

.zones-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.zone-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.85rem;
}

.zone-badge.z1 { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.zone-badge.z2 { background: rgba(74, 222, 128, 0.2); color: #4ade80; }
.zone-badge.z3 { background: rgba(250, 204, 21, 0.2); color: #facc15; }
.zone-badge.z4 { background: rgba(251, 146, 60, 0.2); color: #fb923c; }
.zone-badge.z5 { background: rgba(248, 113, 113, 0.2); color: #f87171; }
.zone-badge.z6 { background: rgba(192, 132, 252, 0.2); color: #c084fc; }

/* Sección informativa y preguntas frecuentes */
.info-guide-section {
  padding-top: 1rem;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--accent-primary);
  font-weight: 700;
  transition: transform var(--transition-fast);
}

.faq-item[open] .faq-question::after {
  content: "−";
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Modales canónicos */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 23, 0.75);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-dialog.modal-lg {
  max-width: 860px;
}

.modal-dialog.modal-sm {
  max-width: 440px;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--accent-primary);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 36px;
}

.btn-close-modal:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

/* Pulsera de carrera (Pacing Wristband) */
.wristband-preview-box {
  background: #ffffff;
  color: #0b0f17;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

.wristband-strip {
  background: #ffffff;
  color: #111827;
  border: 2px dashed #94a3b8;
  padding: 0.75rem 1rem;
  width: max-content;
  min-width: 600px;
  margin: 0 auto;
  font-family: var(--font-mono);
}

.wb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1.5px solid #111827;
  font-size: 0.75rem;
  font-weight: 700;
}

.wb-splits-container {
  display: flex;
  gap: 0.25rem;
  padding-top: 0.5rem;
}

.wb-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid #cbd5e1;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  min-width: 48px;
}

.wb-col.wb-milestone {
  background: #f1f5f9;
  border-color: #0284c7;
}

.wb-col-km {
  font-size: 0.7rem;
  font-weight: 800;
  color: #0284c7;
}

.wb-col-time {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f172a;
}

.wristband-instructions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.wb-instruct-step {
  display: flex;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent-primary);
  font-weight: 800;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Toast de notificación efímera */
.toast-box {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--accent-primary);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-box.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Reglas de impresión para la pulsera */
@media print {
  body * {
    visibility: hidden;
  }

  #modal-wristband,
  #modal-wristband * {
    visibility: visible;
  }

  #modal-wristband {
    position: absolute;
    inset: 0;
    background: transparent;
    padding: 0;
    display: block !important;
  }

  .modal-dialog {
    box-shadow: none;
    border: none;
    max-width: 100%;
  }

  .modal-header,
  .modal-footer,
  .wristband-instructions,
  .modal-desc {
    display: none !important;
  }

  .wristband-preview-box {
    box-shadow: none;
    padding: 0;
  }

  .wristband-strip {
    border: 1.5px dashed #000000 !important;
    color: #000000 !important;
    background: #ffffff !important;
    transform: rotate(0deg);
  }
}

/* Responsividad en tablets y móviles */
@media (max-width: 1024px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #group-pace {
    grid-column: span 2;
  }

  .hero-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .riegel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .tool-card-box {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
  }

  .calc-mode-nav {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  #group-pace {
    grid-column: span 1;
  }

  .form-actions-row {
    flex-direction: column;
  }

  .btn-primary-action,
  .btn-secondary-action {
    width: 100%;
    min-height: 44px;
  }

  .hero-stats-grid {
    grid-template-columns: 1fr;
  }

  .strategy-details-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .riegel-grid {
    grid-template-columns: 1fr;
  }

  .riegel-factor-box {
    width: 100%;
    min-width: 0;
  }

  .wristband-instructions {
    grid-template-columns: 1fr;
  }
}
