/* ==========================================================================
   Temporizador Pomodoro para estudio con descansos activos
   Fijate Tools • Canónico 2026
   ========================================================================== */

:root {
  --bg-page: #0b0f17;
  --bg-card: rgba(18, 24, 38, 0.95);
  --bg-subtle: rgba(255, 255, 255, 0.03);
  --bg-input: #121826;
  --border-card: rgba(255, 255, 255, 0.08);
  --border-focus: #0ea5e9;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --color-work: #0ea5e9;
  --color-work-glow: rgba(14, 165, 233, 0.2);
  --color-short-break: #10b981;
  --color-short-break-glow: rgba(16, 185, 129, 0.2);
  --color-long-break: #8b5cf6;
  --color-long-break-glow: rgba(139, 92, 246, 0.2);

  --accent-color: #0ea5e9;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"],
body.light-theme {
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-input: #f8fafc;
  --border-card: #e2e8f0;
  --border-focus: #0284c7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --color-work: #0284c7;
  --color-work-glow: rgba(2, 132, 199, 0.15);
  --color-short-break: #059669;
  --color-short-break-glow: rgba(5, 150, 105, 0.15);
  --color-long-break: #7c3aed;
  --color-long-break-glow: rgba(124, 58, 237, 0.15);

  --accent-color: #0284c7;
  --success-color: #059669;
  --warning-color: #d97706;
  --danger-color: #dc2626;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  line-height: 1.25;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Contención canónica del layout */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  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 principal */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 2.5rem;
  backdrop-filter: blur(12px);
}

/* Selector de presets */
.presets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-card);
}

.presets-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.presets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 auto;
}

.preset-chip {
  padding: 0.5rem 1rem;
  min-height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-card);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.preset-chip:hover {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--accent-color);
}

.preset-chip.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
}

/* Cuadrícula interactiva blindada de 2 columnas */
.pomodoro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

@media (max-width: 900px) {
  .pomodoro-grid {
    grid-template-columns: 1fr;
  }
}

.pomodoro-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.timer-box {
  align-items: center;
  text-align: center;
}

.side-box {
  justify-content: space-between;
}

/* Selector de tarea / Asignatura */
.task-selector-row {
  width: 100%;
  margin-bottom: 1.25rem;
}

.task-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.task-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

.input-task {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: border-color var(--transition-fast);
  min-height: 44px;
}

.input-task:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Indicador de fase actual */
.phase-indicator-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.1rem;
  border-radius: var(--radius-full);
  background: rgba(14, 165, 233, 0.15);
  color: var(--color-work);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  transition: all var(--transition-smooth);
}

.phase-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.phase-break-short {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-short-break);
}

.phase-break-long {
  background: rgba(139, 92, 246, 0.15);
  color: var(--color-long-break);
}

/* Esfera circular SVG */
.timer-display-wrapper {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0.5rem auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-circle-bg {
  stroke: var(--border-card);
}

.timer-circle-progress {
  stroke: var(--color-work);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear, stroke var(--transition-smooth);
}

.timer-time-content {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-countdown {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.timer-cycle-tag {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Botones de control del temporizador */
.timer-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
}

.btn-timer-main {
  flex: 1 1 180px;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35);
}

.btn-timer-main:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-timer-secondary {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

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

/* Panel de tiempos personalizados */
.custom-durations-panel {
  width: 100%;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-card);
}

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

@media (max-width: 500px) {
  .custom-inputs-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  min-height: 40px;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Columna derecha: Telemetría y pausas activas */
.card-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-title-sub {
  font-size: 1.15rem;
  font-weight: 700;
}

.label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Estadísticas en burbujas */
.stats-pills-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bubble-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
}

.bubble-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

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

/* Módulo de pausa activa ergonómica */
.active-break-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.active-break-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.break-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.break-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.break-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.break-suggestion-body {
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.exercise-item {
  display: none;
  font-size: 0.875rem;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

.exercise-item.active {
  display: block;
}

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

.exercise-name {
  color: var(--accent-color);
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.exercise-desc {
  color: var(--text-secondary);
}

.btn-change-exercise {
  margin-top: 0.85rem;
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  width: 100%;
  justify-content: center;
}

.btn-change-exercise:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--accent-color);
}

/* Ajuste de sonido y pruebas */
.sound-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
}

.sound-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.custom-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.btn-test-sound {
  padding: 0.35rem 0.75rem;
  min-height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-test-sound:hover {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--accent-color);
}

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

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 1.75rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: modalScale 0.2s ease-out;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-icon-alert {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

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

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.btn-modal-secondary {
  padding: 0.6rem 1rem;
  min-height: 40px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}

.btn-modal-secondary:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.btn-modal-danger {
  padding: 0.6rem 1rem;
  min-height: 40px;
  background: var(--warning-color);
  border: none;
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.btn-modal-danger:hover {
  filter: brightness(1.1);
}
