/**
 * Estilos para WOD Timer (Temporizador de intervalos a pantalla completa)
 * Fijate Tools • Suite Canónica
 */

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

  /* Colores del temporizador */
  --color-prep: #0ea5e9;
  --color-work: #10b981;
  --color-rest: #f59e0b;
  --color-pause: #64748b;
  --color-finish: #8b5cf6;
  --color-idle: #1e293b;

  /* Tema oscuro (predeterminado) */
  --bg-app: #0b0f17;
  --bg-card: #131b26;
  --bg-surface: #1a2434;
  --bg-input: #0f1622;
  --border-color: #263345;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;
  --accent-color: #0ea5e9;
  --accent-hover: #0284c7;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #334155;
  --accent-color: #0284c7;
  --accent-hover: #0369a1;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06);
}

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

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

/* Layout canónico */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.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%;
}

/* Encabezado de la herramienta */
.tool-hero {
  margin-bottom: 1.5rem;
  text-align: left;
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: var(--accent-color);
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-transform: none;
}

.tool-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.tool-desc {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 800px;
}

/* Selector de pestañas de modos */
.mode-tabs-nav {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-sub);
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-height: 42px;
}

.mode-tab:hover {
  border-color: var(--accent-color);
  color: var(--text-main);
}

.mode-tab.is-active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

/* Escenario del cronómetro */
.wod-timer-stage {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

/* Pantalla del temporizador de alto impacto */
.timer-display {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  position: relative;
  transition: border-color 0.3s ease, background-color 0.3s ease;
  user-select: none;
}

/* Colores dinámicos según fase */
.timer-display[data-phase="countdown"] {
  border-color: var(--color-prep);
  background: radial-gradient(circle at center, rgba(14, 165, 233, 0.12) 0%, var(--bg-surface) 70%);
}

.timer-display[data-phase="work"] {
  border-color: var(--color-work);
  background: radial-gradient(circle at center, rgba(16, 185, 129, 0.15) 0%, var(--bg-surface) 70%);
}

.timer-display[data-phase="rest"] {
  border-color: var(--color-rest);
  background: radial-gradient(circle at center, rgba(245, 158, 11, 0.15) 0%, var(--bg-surface) 70%);
}

.timer-display[data-phase="paused"] {
  border-color: var(--color-pause);
  background: radial-gradient(circle at center, rgba(100, 116, 139, 0.1) 0%, var(--bg-surface) 70%);
}

.timer-display[data-phase="finished"] {
  border-color: var(--color-finish);
  background: radial-gradient(circle at center, rgba(139, 92, 246, 0.2) 0%, var(--bg-surface) 70%);
}

/* Barra de progreso de fase */
.timer-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.timer-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-color);
  border-radius: 9999px;
  transition: width 0.1s linear, background-color 0.3s ease;
}

.timer-display[data-phase="work"] .timer-progress-fill {
  background: var(--color-work);
}

.timer-display[data-phase="rest"] .timer-progress-fill {
  background: var(--color-rest);
}

.timer-display[data-phase="countdown"] .timer-progress-fill {
  background: var(--color-prep);
}

/* Encabezado del display */
.display-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.phase-pill {
  display: inline-block;
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--border-color);
  color: var(--text-main);
  transition: all 0.3s ease;
}

.timer-display[data-phase="countdown"] .phase-pill {
  background: var(--color-prep);
  color: #ffffff;
}

.timer-display[data-phase="work"] .phase-pill {
  background: var(--color-work);
  color: #ffffff;
}

.timer-display[data-phase="rest"] .phase-pill {
  background: var(--color-rest);
  color: #ffffff;
}

.timer-display[data-phase="finished"] .phase-pill {
  background: var(--color-finish);
  color: #ffffff;
}

.round-info {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-sub);
}

/* Dígitos gigantes */
.timer-digits {
  font-family: var(--font-mono);
  font-size: clamp(4.5rem, 15vw, 9rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-main);
  line-height: 1;
  margin: 0.5rem 0 1rem;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.timer-digits:hover {
  opacity: 0.95;
}

/* Widget AMRAP táctil */
.amrap-touch-zone {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border-color);
}

.amrap-score-display {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-num {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--accent-color);
  line-height: 1.1;
}

.score-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.amrap-buttons-row {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 480px;
}

.btn-tactile-huge {
  flex: 2;
  padding: 1rem 1.5rem;
  background: var(--color-work);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.2s ease;
  min-height: 56px;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-tactile-huge:active {
  transform: scale(0.97);
}

.btn-tactile-secondary {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}

.btn-tactile-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
}

/* Widget For Time */
.fortime-touch-zone {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border-color);
}

.fortime-buttons-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.splits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-height: 120px;
  overflow-y: auto;
  padding: 0.5rem;
}

.split-pill {
  padding: 0.35rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-main);
}

/* Barra de control principal */
.main-controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.btn-ctrl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
  border: 1px solid transparent;
}

.btn-state-start {
  background: var(--color-work);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  flex: 1 1 180px;
  max-width: 240px;
}

.btn-state-start:hover {
  filter: brightness(1.1);
}

.btn-state-pause {
  background: var(--color-rest);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  flex: 1 1 180px;
  max-width: 240px;
}

.btn-state-pause:hover {
  filter: brightness(1.1);
}

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

.btn-secondary:hover {
  border-color: var(--accent-color);
}

.btn-fullscreen {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.3);
  color: var(--accent-color);
}

.btn-fullscreen:hover {
  background: var(--accent-color);
  color: #ffffff;
}

/* Barra de utilidades de audio y atajos */
.utilities-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.btn-icon-small:hover {
  color: var(--text-main);
  border-color: var(--accent-color);
}

.btn-icon-small.is-muted {
  color: #ef4444;
  border-color: #ef4444;
}

.volume-slider {
  width: 80px;
  accent-color: var(--accent-color);
}

.btn-text-action {
  background: none;
  border: none;
  color: var(--accent-color);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.25rem;
}

.shortcuts-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

kbd {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Paneles de configuración */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.settings-heading {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-sub);
}

.form-control {
  width: 100%;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9375rem;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

select.form-control {
  padding-right: 2rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modo pantalla completa nativo */
.is-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 999999 !important;
  border-radius: 0 !important;
  border: none !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 2rem !important;
  box-sizing: border-box !important;
}

.is-fullscreen .timer-digits {
  font-size: clamp(6rem, 25vw, 18rem) !important;
  margin: 1rem 0 !important;
}

.is-fullscreen .round-info {
  font-size: clamp(1.5rem, 4vw, 2.5rem) !important;
}

.is-fullscreen .phase-pill {
  font-size: clamp(1.125rem, 2.5vw, 1.75rem) !important;
  padding: 0.5rem 1.5rem !important;
}

/* Modales accesibles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.modal-overlay.is-active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  text-align: left;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.summary-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.summary-metric {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
}

.text-accent {
  color: var(--accent-color);
}

.text-success {
  color: var(--color-work);
}

.splits-summary-list {
  list-style: none;
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.splits-summary-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Guía SEO y acordeones explicativos */
.seo-guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  margin-top: 2rem;
}

.seo-heading {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.seo-guide-section p {
  color: var(--text-sub);
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.seo-guide-section h3 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.5rem 0 0.5rem;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.faq-question {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.faq-answer {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Responsive */
@media (max-width: 768px) {
  .tool-layout {
    padding: 0 0.75rem;
    margin: 1rem auto 2rem;
  }

  .wod-timer-stage {
    padding: 1rem;
    border-radius: 14px;
  }

  .timer-display {
    padding: 1.75rem 0.75rem;
  }

  .timer-digits {
    font-size: clamp(3.75rem, 18vw, 5.5rem);
  }

  .main-controls-bar {
    flex-direction: column;
  }

  .btn-ctrl {
    width: 100%;
    max-width: 100%;
  }

  .utilities-bar {
    flex-direction: column;
    align-items: flex-start;
  }

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