/* Estilos generales */

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #F4F8F9;
  color: #2D3E50;
}

/* Tabs de navegación */

.tabs {
  display: flex;
  height: 56px;
  border-bottom: 1px solid #C4D9E4;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  color: #7A99AA;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
}

.tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #2D3E50;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.tab.active {
  color: #2D3E50;
}

.tab.active::after {
  transform: scaleX(1);
}

/* Slider */

.slider-viewport {
  position: relative;
  width: 100%;
  height: calc(100% - 56px);
  overflow: hidden;
}

/* Flechas de navegación */

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(45, 62, 80, 0.07);
  border: 1px solid rgba(45, 62, 80, 0.15);
  color: #2D3E50;
  font-size: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
}

.arrow:hover {
  background: rgba(45, 62, 80, 0.14);
}

.arrow-left  { left: 16px; }
.arrow-right { right: 16px; }

.arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

.slider-track {
  display: flex;
  width: 200%;
  height: 100%;
  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Secciones */

.section {
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #F4F8F9;
}

/* ── Timer section ──────────────────────────────────── */

#timer {
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Sub-tabs */
.timer-tabs {
  display: flex;
  border-bottom: 1px solid #C4D9E4;
  flex-shrink: 0;
}

.timer-tab {
  flex: 1;
  padding: 14px 0;
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #7A99AA;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.timer-tab::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: #2D3E50;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.timer-tab.active { color: #2D3E50; }
.timer-tab.active::after { transform: scaleX(1); }

/* Panels */
.timer-panel { display: none; flex-direction: column; flex: 1; }
.timer-panel.active { display: flex; }

/* Config */
.timer-config {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 24px 24px 16px;
  flex-wrap: wrap;
}

.config-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.config-field > label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #7A99AA;
  text-transform: uppercase;
}

.config-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.config-input-row input[type="number"] {
  width: 56px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 6px 4px;
  border: 1.5px solid #C4D9E4;
  border-radius: 8px;
  background: #fff;
  color: #2D3E50;
  -moz-appearance: textfield;
}

.config-input-row input[type="number"]::-webkit-outer-spin-button,
.config-input-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.config-input-row input:disabled { opacity: 0.4; }

.cfg-unit {
  font-size: 0.75rem;
  color: #7A99AA;
  font-weight: 600;
}

.cfg-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid #C4D9E4;
  background: none;
  font-size: 1.1rem;
  color: #4A6478;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}

.cfg-btn:hover:not(:disabled) { background: #E6EFF4; }
.cfg-btn:disabled { opacity: 0.3; cursor: default; }

.select-row select {
  padding: 7px 10px;
  border: 1.5px solid #C4D9E4;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #2D3E50;
  background: #fff;
  cursor: pointer;
}

/* Toggle switch (Time Cap) */
.toggle-label { display: flex; align-items: center; cursor: pointer; }
.toggle-label input[type="checkbox"] { display: none; }

.toggle-track {
  width: 36px; height: 20px;
  border-radius: 10px;
  background: #C4D9E4;
  position: relative;
  transition: background 0.2s;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.toggle-label input:checked + .toggle-track { background: #2D3E50; }
.toggle-label input:checked + .toggle-track::after { transform: translateX(16px); }

/* Display */
.timer-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
}

.timer-phase {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #7A99AA;
  text-transform: uppercase;
  min-height: 1.2em;
}

.timer-clock {
  font-size: clamp(4rem, 18vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #2D3E50;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer-progress {
  font-size: 0.85rem;
  font-weight: 600;
  color: #7A99AA;
}

.timer-clock.warn { color: #E07B54; }
.timer-clock.done { color: #4A6478; }

/* Controls */
.timer-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 16px 24px 32px;
}

.ctrl-btn {
  padding: 14px 32px;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s, transform 0.1s;
}

.ctrl-btn:active { transform: scale(0.97); }
.ctrl-btn.primary  { background: #2D3E50; color: #F4F8F9; }
.ctrl-btn.primary:hover { background: #3d5166; }
.ctrl-btn.secondary { background: #E6EFF4; color: #4A6478; }
.ctrl-btn.secondary:hover { background: #C4D9E4; }

/* EMOM */
.emom-config { gap: 16px; }

.cfg-time-display {
  width: 68px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 6px 4px;
  border: 1.5px solid #C4D9E4;
  border-radius: 8px;
  background: #fff;
  color: #2D3E50;
  cursor: default;
  letter-spacing: 0.04em;
}

/* Date strip */

.date-strip {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #F4F8F9;
  border-bottom: 1px solid #C4D9E4;
  padding: 10px 16px 12px;
  flex-shrink: 0;
}

.date-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

#month-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #4A6478;
  text-transform: capitalize;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

#month-label:hover {
  background: #E6EFF4;
  color: #2D3E50;
}

.today-btn {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 20px;
  border: 1.5px solid #C4D9E4;
  background: transparent;
  color: #4A6478;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.today-btn:hover {
  background: #E6EFF4;
  color: #2D3E50;
  border-color: #A8C4D0;
}

.week-arrow {
  background: none;
  border: none;
  color: #7A99AA;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
}

.week-arrow:hover { color: #2D3E50; }

.date-days {
  display: flex;
  justify-content: space-between;
}

/* Separador entre calendario abierto y fila semanal */
.month-calendar.open + .date-days {
  border-top: 1px solid #C4D9E4;
  padding-top: 10px;
  margin-top: 2px;
}

.date-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  background: none;
  transition: background 0.15s;
}

.date-day:hover { background: #E6EFF4; }

.day-letter {
  font-size: 0.65rem;
  font-weight: 700;
  color: #7A99AA;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-num {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 600;
  color: #4A6478;
  transition: background 0.15s, color 0.15s;
}

.date-day.today .day-num {
  color: #2D3E50;
  border: 1.5px solid #A8C4D0;
}

.date-day.selected .day-letter {
  color: #2D3E50;
}

.date-day.selected .day-num {
  background: #2D3E50;
  color: #F4F8F9;
  border: none;
}

/* Calendario mensual (pushdown dentro del date-strip) */

.month-calendar {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.month-calendar.open {
  max-height: 400px;
}

.cal-inner {
  padding: 0 0 0;
  border-top: 0px solid #C4D9E4;
  transition: padding 0.3s ease, border-top-width 0.3s ease;
}

.month-calendar.open .cal-inner {
  padding: 12px 0 14px;
  border-top-width: 1px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#cal-month-year {
  font-size: 0.9rem;
  font-weight: 700;
  color: #2D3E50;
  text-transform: capitalize;
}

.cal-arrow {
  background: none;
  border: none;
  color: #7A99AA;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  transition: color 0.2s;
}

.cal-arrow:hover { color: #2D3E50; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.cal-weekdays span {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #7A99AA;
  text-transform: uppercase;
  padding: 4px 0;
  letter-spacing: 0.04em;
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  color: #2D3E50;
  transition: background 0.15s, color 0.15s;
}

.cal-day:hover:not(.selected) { background: #E6EFF4; }

.cal-day.other-month { color: #A8C4D0; }
.cal-day.other-month:hover:not(.selected) { color: #4A6478; background: #E6EFF4; }

.cal-day.today {
  border: 1.5px solid #A8C4D0;
  color: #2D3E50;
}

.cal-day.selected {
  background: #2D3E50;
  color: #F4F8F9;
  font-weight: 700;
}

/* Sub-secciones de Workouts */

#workouts {
  overflow-y: auto;
  padding: 0;
}

.workout-subsection {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 32px;
  border-bottom: 1px solid #C4D9E4;
}

.workout-subsection h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.workout-subsection p {
  font-size: 1rem;
  color: #4A6478;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Grid de videos */

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.video-grid iframe,
.video-grid .workout-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 8px;
  background: #2D3E50;
}

/* Ocultar flechas en dispositivos táctiles */

@media (hover: none) and (pointer: coarse) {
  .arrow { display: none; }
}
