/* ==========================================================================
   RutinIA - Hoja de Estilos Moderna y Rendimiento Atlético
   ========================================================================== */

:root {
  --bg-dark: #080C14;
  --bg-card: #111726;
  --bg-card-hover: #162033;
  --bg-card-glass: rgba(17, 23, 38, 0.85);
  --border-color: #1E293B;
  --border-focus: #38BDF8;

  --primary: #10B981;
  --primary-glow: rgba(16, 185, 129, 0.35);
  --primary-hover: #059669;
  --primary-light: #34D399;

  --accent-cyan: #06B6D4;
  --accent-amber: #F59E0B;
  --accent-amber-glow: rgba(245, 158, 11, 0.35);
  --accent-red: #EF4444;
  --accent-purple: #8B5CF6;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.07) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Scrollbar estética */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: #1E293B;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-cyan) 100%);
  box-shadow: 0 0 15px var(--primary-glow);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
  fill: #080C14;
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #FFFFFF, #E2E8F0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.btn-icon {
  background: #172033;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: #1F2D47;
  color: var(--text-main);
  border-color: #334155;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  animation: pulse-dot 2s infinite;
}

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

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */

.nav-tabs {
  display: flex;
  background: #0E1524;
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab-btn.active {
  color: #FFFFFF;
  background: #192338;
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.nav-tab-btn.active .tab-badge {
  background: var(--primary);
  color: #080C14;
}

.tab-badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  background: #202B40;
  color: var(--text-muted);
}

/* ==========================================================================
   Main Container & Sections
   ========================================================================== */

.main-content {
  flex: 1;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem 6rem 1rem;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

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

/* ==========================================================================
   Cards & Layout Components
   ========================================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.2);
}

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

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ==========================================================================
   Form Controls & Level Selectors
   ========================================================================== */

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: #0B101D;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.segmented-control.segmented-2 {
  grid-template-columns: repeat(2, 1fr);
}

.segmented-option {
  position: relative;
  text-align: center;
}

.segmented-option input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.segmented-option label {
  display: block;
  padding: 0.65rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.segmented-option input:checked + label {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.input-select, .input-text {
  width: 100%;
  background: #0B101D;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.input-select:focus, .input-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-range {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}

.slider-value {
  min-width: 75px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  background: #0B101D;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* ==========================================================================
   Buttons & Actions
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 15px var(--primary-glow);
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #1E293B;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #2C3C56;
  border-color: #475569;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #FFFFFF;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ==========================================================================
   AI Routine Preview Card
   ========================================================================== */

.routine-banner {
  background: linear-gradient(135deg, #131E33 0%, #172642 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.routine-banner-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.routine-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.meta-pill.highlight {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Listado de Ejercicios en la Rutina */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 1.25rem 0;
}

.exercise-item {
  background: #0D1322;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition);
}

.exercise-item:hover {
  border-color: #334155;
  background: #11182B;
}

.exercise-item-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.exercise-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1C273C;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.exercise-info h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.exercise-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.exercise-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  flex-shrink: 0;
}

.badge-work {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
}

.badge-rest {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.badge-warmup {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
}

.badge-cooldown {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.15);
  color: #22D3EE;
}

.badge-series-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.18);
  color: #A5B4FC;
  border: 1px solid rgba(99, 102, 241, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  vertical-align: middle;
}

.badge-series-reps {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.2);
  color: #C7D2FE;
  border: 1px solid rgba(99, 102, 241, 0.4);
  white-space: nowrap;
}

/* ==========================================================================
   Fases de la Rutina (Calentamiento, Principal, Estiramiento)
   ========================================================================== */

.routine-phases-container {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.phase-section {
  border-radius: var(--radius-md);
  background: rgba(13, 19, 34, 0.65);
  border: 1px solid var(--border-color);
  padding: 1.1rem;
  transition: var(--transition);
}

.phase-section.phase-warmup {
  border-left: 4px solid #F59E0B;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04) 0%, rgba(13, 19, 34, 0.7) 100%);
}

.phase-section.phase-main {
  border-left: 4px solid var(--primary);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, rgba(13, 19, 34, 0.7) 100%);
}

.phase-section.phase-cooldown {
  border-left: 4px solid #06B6D4;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.04) 0%, rgba(13, 19, 34, 0.7) 100%);
}

.phase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.phase-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.phase-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.phase-badge-warmup {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.phase-badge-main {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.phase-badge-cooldown {
  background: rgba(6, 182, 212, 0.15);
  color: #22D3EE;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.phase-badge-circuit {
  background: rgba(59, 130, 246, 0.18);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.exercise-num-warmup {
  color: #FBBF24 !important;
  background: rgba(245, 158, 11, 0.15) !important;
}

.exercise-num-main {
  color: var(--primary) !important;
  background: rgba(16, 185, 129, 0.15) !important;
}

.exercise-num-cooldown {
  color: #22D3EE !important;
  background: rgba(6, 182, 212, 0.15) !important;
}

/* ==========================================================================
   Interactive Delta-Time Timer View
   ========================================================================== */

/* ==========================================================================
   Reloj / Cronómetro General en Vivo y Selector de Modo Circuito
   ========================================================================== */
.timer-overall-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  background: rgba(11, 16, 29, 0.75);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
}

.timer-stat-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #0E1626;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
}

.timer-stat-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.timer-stat-content {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.timer-stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.timer-stat-digits {
  font-family: 'Inter', monospace;
  font-size: 1.05rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 0.02em;
}

.timer-stat-elapsed .timer-stat-digits {
  color: var(--accent-cyan);
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.45);
}

.timer-stat-round .timer-stat-digits {
  color: #FBBF24;
}

.btn-timer-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--primary-light);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-timer-mode-toggle:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Selector de Modo en Vista Previa */
.execution-mode-box {
  background: rgba(11, 16, 29, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
}

.execution-mode-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.execution-mode-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.55rem;
}

.execution-mode-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #0E1626;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.execution-mode-btn input {
  display: none;
}

.execution-mode-btn:hover {
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--text-main);
}

.execution-mode-btn.active {
  background: rgba(16, 185, 129, 0.14);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.timer-section {
  text-align: center;
}

.timer-phase-container {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.timer-discipline-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: var(--transition);
}

.timer-block-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: var(--transition);
}

.block-calentamiento {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
}

.block-principal {
  background: rgba(16, 185, 129, 0.2);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 15px var(--primary-glow);
}

.block-estiramiento {
  background: rgba(6, 182, 212, 0.2);
  color: #22D3EE;
  border: 1px solid rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.25);
}

.timer-phase-pill {
  display: inline-block;
  padding: 0.35rem 1.25rem;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0;
  transition: var(--transition);
}

.phase-prep {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}

.phase-work {
  background: rgba(16, 185, 129, 0.2);
  color: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: 0 0 20px var(--primary-glow);
}

.phase-rest {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber);
  box-shadow: 0 0 20px var(--accent-amber-glow);
}

/* Circular Timer Ring */
.timer-dial-wrapper {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 1.5rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.timer-circle-bg {
  fill: none;
  stroke: #162033;
  stroke-width: 14;
}

.timer-circle-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 14;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
  filter: drop-shadow(0 0 10px var(--primary-glow));
}

.timer-dial-center {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.timer-digits {
  font-size: 4.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #FFFFFF;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.5);
}

.timer-sublabel {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.35rem;
  text-transform: uppercase;
}

/* Workout progress header */
.workout-active-header {
  margin-bottom: 1.5rem;
}

.workout-active-name {
  font-size: 1.75rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 0.35rem;
}

.workout-active-meta {
  font-size: 0.95rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.workout-instructions {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0.5rem auto 0 auto;
  background: #0B101D;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Timer Controls */
.timer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn-timer-primary {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #059669);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 25px var(--primary-glow);
  transition: var(--transition);
}

.btn-timer-primary:hover {
  transform: scale(1.06);
}

.btn-timer-primary svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.btn-timer-secondary {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #172136;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-timer-secondary:hover {
  background: #22314D;
  color: var(--text-main);
}

.btn-timer-secondary svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Audio & Settings toggles during workout */
.timer-toggles {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-item input {
  accent-color: var(--primary);
  cursor: pointer;
}

/* Next up preview card */
.next-exercise-card {
  background: #0B101D;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.next-exercise-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.next-exercise-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   Statistics & Chart View
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.stat-card.amber::after {
  background: var(--accent-amber);
}

.stat-card.cyan::after {
  background: var(--accent-cyan);
}

.stat-card.purple::after {
  background: var(--accent-purple);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-val {
  font-size: 2.1rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0.25rem 0;
  line-height: 1.1;
}

.stat-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.chart-wrapper {
  position: relative;
  height: 280px;
  width: 100%;
  margin-top: 1rem;
}

/* History table */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.history-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.history-table td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
  color: var(--text-main);
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   Saved Routines Library
   ========================================================================== */

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

.saved-routine-card {
  background: #0E1524;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition);
}

.saved-routine-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.saved-routine-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 0.4rem;
}

.saved-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Modals & Notifications
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #FFFFFF;
}

/* Celebration / Finished workout modal */
.celebrate-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem auto;
  box-shadow: 0 0 30px var(--primary-glow);
}

.celebrate-icon svg {
  width: 38px;
  height: 38px;
  fill: #080C14;
}

/* Toast alert messages */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #1A2337;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  color: var(--text-main);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  animation: slideInRight 0.3s ease;
  max-width: 350px;
}

.toast.warning {
  border-left-color: var(--accent-amber);
}

.toast.error {
  border-left-color: var(--accent-red);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, #111827 25%, #1F293D 50%, #111827 75%);
  background-size: 200% 100%;
  animation: loadingSkeleton 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes loadingSkeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   VISTA PREVIA DEL PROMPT (FORMULARIO)
   ========================================================================== */

.prompt-preview-card {
  background: #0B101D;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: var(--transition);
}

.prompt-preview-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

.prompt-preview-header {
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: #0E1526;
  user-select: none;
}

.prompt-preview-header:hover {
  background: #131C31;
}

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

.prompt-icon {
  font-size: 1.05rem;
}

.prompt-model-tag {
  background: rgba(56, 189, 248, 0.12);
  color: var(--border-focus);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-family: monospace;
}

.btn-text-sm {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-text-sm:hover {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary-light);
}

.prompt-preview-body {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  animation: fadeIn 0.2s ease;
}

.prompt-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-copy-sm {
  background: #172136;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.btn-copy-sm:hover {
  background: var(--primary);
  color: #080C14;
  border-color: var(--primary);
}

.prompt-block {
  margin-bottom: 0.85rem;
}

.prompt-block:last-child {
  margin-bottom: 0;
}

.prompt-block-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  letter-spacing: 0.5px;
}

.prompt-code {
  background: #060911;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  color: #CBD5E1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
}

/* ==========================================================================
   MONITOR DE CONEXIÓN EN VIVO CON GROQ IA
   ========================================================================== */

.ai-connection-tracker {
  background: linear-gradient(145deg, #0D1424, #090E1A);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.1);
  animation: slideDown 0.3s ease;
}

.tracker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tracker-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.98rem;
  font-weight: 800;
  color: #FFFFFF;
}

.pulse-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
  animation: pulse-dot 1.2s infinite;
}

.tracker-chip {
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-family: monospace;
}

.tracker-progress-bar {
  width: 100%;
  height: 6px;
  background: #162033;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.tracker-progress-fill {
  height: 100%;
  width: 15%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--primary), var(--accent-cyan));
  background-size: 200% 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: shimmerProgress 2s linear infinite;
}

@keyframes shimmerProgress {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.tracker-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tracker-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  opacity: 0.4;
  transition: all 0.3s ease;
}

.tracker-step.active {
  opacity: 1;
}

.tracker-step.completed {
  opacity: 0.95;
}

.step-icon-wrap {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background: #141C2E;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  position: relative;
  transition: var(--transition);
}

.step-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.step-check {
  display: none;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 800;
}

.tracker-step.active .step-icon-wrap {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.tracker-step.active .step-spinner {
  display: block;
}

.tracker-step.completed .step-icon-wrap {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.2);
}

.tracker-step.completed .step-check {
  display: block;
}

.step-content {
  flex: 1;
}

.step-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #FFFFFF;
}

.tracker-step.active .step-title {
  color: var(--accent-cyan);
}

.step-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   AI GENERATION BADGE & BOTÓN INSPECTOR (VISTA PREVIA)
   ========================================================================== */

.routine-ai-badge {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ai-badge-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.ai-badge-icon {
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px var(--primary));
}

.ai-badge-text {
  font-size: 0.88rem;
  font-weight: 800;
  color: #FFFFFF;
}

.ai-badge-chip {
  background: #0E1626;
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-light);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-family: monospace;
}

.ai-badge-chip.latency {
  color: var(--accent-cyan);
}

.ai-badge-chip.tokens {
  color: var(--accent-amber);
}

.btn-inspect-prompt {
  background: #152033;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-inspect-prompt:hover {
  background: var(--primary);
  color: #080C14;
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--primary-glow);
}

/* ==========================================================================
   MODAL DE INSPECCIÓN DE PROMPT Y METADATOS
   ========================================================================== */

.modal-box-wide {
  max-width: 680px;
}

.modal-title-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.prompt-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
  margin: 1.25rem 0;
}

.prompt-meta-card {
  background: #0B101D;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
}

.prompt-meta-card .meta-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.prompt-meta-card .meta-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-top: 0.2rem;
  font-family: monospace;
}

.prompt-meta-card .meta-val.highlight {
  color: var(--accent-cyan);
}

.prompt-meta-card .meta-val.success {
  color: var(--primary);
}

.prompt-tab-buttons {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.prompt-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.prompt-tab-btn:hover {
  color: #FFFFFF;
  background: #141C2E;
}

.prompt-tab-btn.active {
  background: #17233B;
  color: var(--primary-light);
  border-color: rgba(16, 185, 129, 0.3);
}

.prompt-tab-panel {
  display: none;
  animation: fadeIn 0.25s ease;
}

.prompt-tab-panel.active {
  display: block;
}

.prompt-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  gap: 0.5rem;
}

.btn-copy-code {
  background: #141C2E;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy-code:hover {
  background: var(--primary);
  color: #080C14;
}

.prompt-code-full {
  background: #060911;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: #E2E8F0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}

.prompt-code-full.json-syntax {
  color: #38BDF8;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   ESTILOS DE PLANES POR ALCANCE (SEMANA, MES, LARGO PLAZO)
   ========================================================================== */

.plan-overview-box {
  background: #0B101D;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.plan-overview-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-overview-desc {
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* Hitos / Metas a Largo Plazo */
.hitos-container {
  margin-bottom: 1.5rem;
  background: #0D1424;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
}

.hitos-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hitos-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hito-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: #CBD5E1;
  background: #080C14;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-cyan);
}

.hito-num {
  color: var(--primary);
  font-weight: 800;
  font-size: 0.85rem;
}

/* Tarjetas de Días en Plan Semanal */
.plan-dias-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.plan-dia-card {
  background: #0E1526;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.plan-dia-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.plan-dia-card.rest-day {
  border-left: 4px solid var(--accent-amber);
  background: #0B101D;
}

.plan-dia-card.workout-day {
  border-left: 4px solid var(--primary);
}

.plan-dia-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
}

.plan-dia-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.plan-dia-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.plan-dia-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #FFFFFF;
}

.plan-dia-focus {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.plan-dia-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-cargar-timer {
  background: linear-gradient(135deg, var(--primary), #059669);
  color: #080C14;
  border: none;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-cargar-timer:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.plan-dia-body {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: #090E1A;
}

/* Semanas en Plan Mensual */
.plan-semanas-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.plan-semana-card {
  background: #0B101D;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.plan-semana-header {
  padding: 0.85rem 1.25rem;
  background: #111A2E;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plan-semana-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.plan-semana-obj {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Fases en Plan a Largo Plazo */
.plan-fases-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.plan-fase-card {
  background: #0B101D;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border-top: 3px solid var(--accent-cyan);
}

.plan-fase-header {
  margin-bottom: 1rem;
}

.plan-fase-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
}

.plan-fase-meta {
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-top: 0.2rem;
}

/* ==========================================================================
   Disciplinas de Entrenamiento y Combinaciones Híbridas
   ========================================================================== */
.disciplinas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.disciplina-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.85rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.disciplina-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.disciplina-chip:hover {
  border-color: rgba(16, 185, 129, 0.45);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.disciplina-chip.active {
  background: rgba(16, 185, 129, 0.09);
  border-color: var(--primary);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.22);
}

.disciplina-chip::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: var(--transition);
}

.disciplina-chip.active::after {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.disciplina-chip .chip-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.25rem;
  padding-right: 12px;
}

.disciplina-chip .chip-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.disciplina-chip .chip-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  transition: var(--transition);
}

.disciplina-chip.active .chip-name {
  color: #FFFFFF;
}

.disciplina-chip .chip-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.combos-rapidos-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.75rem;
  background: rgba(17, 23, 38, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  margin-bottom: 0.25rem;
}

.combos-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent-amber);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: 0.25rem;
}

.btn-combo-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  padding: 0.28rem 0.7rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-combo-pill:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-combo-pill.btn-combo-reset {
  border-color: rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
}

.btn-combo-pill.btn-combo-reset:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-red);
  color: #FFFFFF;
}

.badge-hybrid {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(6, 182, 212, 0.22));
  border: 1px solid rgba(6, 182, 212, 0.45);
  color: var(--accent-cyan);
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.segmented-option input#molestiaPresente:checked + label {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}

/* ==========================================================================
   Molestias Físicas o Dolores (Cuidado y Adaptación de la Rutina)
   ========================================================================== */
.molestia-expand-container {
  background: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  animation: molestiaFadeIn 0.22s ease-out;
}

@keyframes molestiaFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.molestia-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.btn-molestia-chip {
  background: #0E1626;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  padding: 0.32rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.btn-molestia-chip:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
  color: #FCD34D;
  transform: translateY(-1px);
}

.btn-molestia-chip.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.35));
  border-color: #F59E0B;
  color: #FEF3C7;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.meta-pill.badge-molestia {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.38);
  font-weight: 600;
}

/* ==========================================================================
   Lugar y Herramientas Disponibles (Escritura libre + Sugerencias rápidas)
   ========================================================================== */
.input-with-clear-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-clear-wrap .input-text {
  padding-right: 2.75rem;
  font-weight: 500;
  color: #FFFFFF;
}

.btn-input-clear {
  position: absolute;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.btn-input-clear:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #FFFFFF;
  border-color: var(--accent-red);
}

.quick-tools-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  background: rgba(17, 23, 38, 0.55);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}

.quick-tools-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: 0.2rem;
}

.btn-tool-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  padding: 0.24rem 0.65rem;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-tool-pill:hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: var(--primary);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-tool-pill.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .disciplinas-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .combos-rapidos-bar {
    gap: 0.35rem;
  }
  .btn-combo-pill {
    font-size: 0.7rem;
    padding: 0.22rem 0.55rem;
  }
  .app-header {
    padding: 0.75rem 1rem;
  }
  .brand-text {
    font-size: 1.1rem;
  }
  .main-content {
    padding: 1rem 0.75rem 5.5rem 0.75rem;
  }
  .timer-dial-wrapper {
    width: 250px;
    height: 250px;
  }
  .timer-digits {
    font-size: 3.8rem;
  }
  .workout-active-name {
    font-size: 1.45rem;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   Botones de Acción en Encabezado (Acceso Rápido Rutinas & Estadísticas)
   ========================================================================== */
.btn-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #172033;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-header-pill:hover {
  background: #1F2D47;
  border-color: rgba(16, 185, 129, 0.4);
  color: #FFFFFF;
  transform: translateY(-1px);
}

@media (max-width: 580px) {
  .btn-header-pill span {
    display: none;
  }
  .btn-header-pill {
    padding: 0.4rem;
    border-radius: var(--radius-md);
  }
}

/* ==========================================================================
   Filtros por Alcance Temporal (Día, Semana, Mes, Año / Objetivos)
   ========================================================================== */
.saved-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.5rem;
  background: #0E1524;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.btn-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-filter-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.btn-filter-pill.active {
  background: #172033;
  color: var(--primary);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.filter-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.btn-filter-pill.active .filter-count {
  background: rgba(16, 185, 129, 0.2);
  color: var(--primary);
}

/* ==========================================================================
   Badges de Alcance y Estados de Finalización
   ========================================================================== */
.badge-alcance-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-status-completed {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-status-incomplete {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ==========================================================================
   Métricas KPI Comparativas: Completadas vs Sin Acabar
   ========================================================================== */
.stats-completion-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-kpi-card {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-kpi-card.kpi-completed::after { background: var(--primary); }
.stat-kpi-card.kpi-incomplete::after { background: var(--accent-amber); }
.stat-kpi-card.kpi-rate::after { background: var(--accent-cyan); }
.stat-kpi-card.kpi-avg::after { background: var(--accent-purple); }

.stat-kpi-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.kpi-icon {
  font-size: 1.1rem;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-val {
  font-size: 2rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0.15rem 0;
  line-height: 1.1;
}

.stat-kpi-card.kpi-completed .kpi-val { color: #34D399; }
.stat-kpi-card.kpi-incomplete .kpi-val { color: #FBBF24; }
.stat-kpi-card.kpi-rate .kpi-val { color: var(--accent-cyan); }
.stat-kpi-card.kpi-avg .kpi-val { color: #C084FC; }

.kpi-desc {
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Cuadros Estadísticos Comparativos (Grid & Doughnut Chart)
   ========================================================================== */
.charts-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.chart-card {
  margin-bottom: 0 !important;
}

.doughnut-chart-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 280px;
}

.chart-center-metric {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.center-pct {
  font-size: 1.85rem;
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1;
}

.center-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

/* ==========================================================================
   Modal de Finalizar / Detener Entrenamiento
   ========================================================================== */
.finish-modal-box {
  max-width: 480px;
  text-align: center;
}

.finish-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.finish-icon-wrap.completed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 20px var(--primary-glow);
}

.finish-progress-container {
  background: #0E1524;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.finish-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.finish-progress-track {
  width: 100%;
  height: 10px;
  background: #172033;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.finish-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-amber), var(--primary));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.finish-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.finish-metric-box {
  background: #0D1322;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.5rem;
}

.finish-metric-box .metric-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.finish-metric-box .metric-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
}

.finish-actions-column {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.btn-warning-action {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #FBBF24;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-warning-action:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.7);
  color: #FDE68A;
}

/* ==========================================================================
   Gestor Multimedia (Imágenes de Ejercicios y Videos de Técnica)
   ========================================================================== */

.media-tabs-bar {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  padding-bottom: 0.35rem;
}

.media-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.media-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.media-tab-btn.active {
  background: #172033;
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.media-tab-panel {
  display: none;
}

.media-tab-panel.active {
  display: block;
}

.media-upload-area {
  border: 2px dashed rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-md);
  background: rgba(6, 182, 212, 0.04);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.media-upload-area:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
}

.media-live-preview-box {
  margin-top: 1rem;
  background: #0B101D;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.preview-box-header {
  padding: 0.5rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  background: #0E1524;
  border-bottom: 1px solid var(--border-color);
}

.preview-box-content {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}

.preview-box-content img {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.preview-box-content iframe,
.preview-box-content video {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  border: none;
}

.exercise-media-form-card {
  background: #0E1524;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 0.75rem;
}

.exercise-media-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-color);
}

.btn-yt-search {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #F87171;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: var(--transition);
}

.btn-yt-search:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #FFFFFF;
}

/* Modal Lightbox Viewer */
.modal-box-viewer {
  max-width: 680px;
  width: 95%;
  padding: 1.5rem;
}

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

.viewer-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #FFFFFF;
}

.viewer-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
  text-transform: uppercase;
}

.viewer-media-container {
  width: 100%;
  min-height: 240px;
  max-height: 420px;
  background: #000000;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.viewer-media-container img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.viewer-media-container iframe,
.viewer-media-container video {
  width: 100%;
  height: 100%;
  min-height: 300px;
  aspect-ratio: 16 / 9;
  border: none;
}

.viewer-instructions-box {
  background: #0E1524;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.instructions-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.viewer-instructions-box p {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.45;
}

.viewer-footer-actions {
  display: flex;
  justify-content: flex-end;
}

/* Demostración Visual en el Temporizador */
.workout-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.timer-visual-thumb-wrap {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  background: #172033;
  border: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.timer-visual-thumb-wrap:hover {
  transform: scale(1.05);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.timer-visual-illustration {
  font-size: 1.6rem;
}

.timer-visual-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.timer-visual-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}

.timer-visual-actions {
  margin-top: 0.5rem;
}

.btn-timer-video {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #FBBF24;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  animation: pulse-border 2.5s infinite;
}

.btn-timer-video:hover {
  background: rgba(245, 158, 11, 0.3);
  color: #FFFFFF;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

/* Miniaturas en Lista de Ejercicios */
.exercise-media-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: #172033;
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.exercise-media-thumb:hover {
  border-color: var(--accent-cyan);
  transform: scale(1.06);
}

.exercise-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.exercise-media-thumb .thumb-svg-icon {
  font-size: 1.3rem;
}

.badge-video-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.badge-video-pill:hover {
  background: rgba(245, 158, 11, 0.3);
  color: #FFFFFF;
}

.btn-item-media {
  background: #172033;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-item-media:hover {
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.35);
  background: #1F2D47;
}

/* Portada en Tarjeta de Rutina Guardada */
.saved-routine-cover {
  width: 100%;
  height: 110px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow: hidden;
  position: relative;
  margin: -1.25rem -1.25rem 0.85rem -1.25rem;
  width: calc(100% + 2.5rem);
}

.saved-routine-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.saved-cover-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(14, 21, 36, 0.2) 0%, #0E1524 95%);
}

.saved-cover-video-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   MODAL DE DETALLE Y VISUALIZADOR DE RUTINA GUARDADA
   ========================================================================== */
.modal-box-routine-detail {
  max-width: 840px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: #0E1524;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.modal-detail-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin: 0.85rem 0;
}

.saved-routine-clickable-area {
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s ease;
}

.saved-routine-clickable-area:hover h3 {
  color: var(--primary) !important;
}

.saved-routine-card {
  cursor: pointer;
}

.saved-routine-card:hover {
  border-color: rgba(16, 185, 129, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.btn-card-view {
  background: rgba(16, 185, 129, 0.15) !important;
  color: var(--primary) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  font-weight: 700 !important;
}

.btn-card-view:hover {
  background: var(--primary) !important;
  color: #07090E !important;
}

/* ==========================================================================
   AUTENTICACIÓN, PERFIL DE ATLETA Y HEADER USER PILL
   ========================================================================== */

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  color: #FFFFFF !important;
  padding: 0.35rem 0.75rem !important;
  border-radius: var(--radius-full) !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-profile-pill:hover {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: var(--primary) !important;
}

#headerUserName {
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 0.88rem;
  color: #FFFFFF;
}

.user-avatar-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10B981, #06B6D4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

/* Modales de Autenticación y Perfil */
.modal-box-auth {
  max-width: 460px;
}

/* ============================================================================
   MODAL DE PERFIL DE ATLETA (UX LIMPIA Y RESPONSIVA)
   ============================================================================ */
/* Ajuste principal del modal para que no desborde la pantalla */
.modal-perfil-container,
.modal-box-profile {
  width: 95%;
  max-width: 750px; /* Ancho suficiente para dos columnas */
  max-height: 85vh; /* Evita que sobrepase el alto del monitor */
  overflow-y: auto; /* Habilita el scroll interno si el contenido es muy largo */
  padding: 25px;
  background: #0f172a; /* Color oscuro de fondo */
  border-radius: 12px;
}

/* Sistema de grilla para organizar los inputs en dos columnas limpias */
.modal-perfil-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  align-items: start;
}

/* Si decides mantener las pastillas de selección en algún lado, asegúrate de que bajen a la siguiente línea */
.pill-container {
  display: flex;
  flex-wrap: wrap; /* CRÍTICO: Obliga a los elementos a bajar si no caben */
  gap: 10px;
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-icon-badge {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 0.3rem;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.auth-method-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 1.25rem;
}

.auth-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: rgba(16, 185, 129, 0.2);
  color: #10B981;
}

/* Input con botón de ver/ocultar contraseña */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper .input-text {
  padding-right: 2.75rem !important;
  width: 100%;
}

.btn-toggle-password {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
  transition: color 0.2s ease, transform 0.15s ease;
  user-select: none;
}

.btn-toggle-password:hover {
  color: var(--primary);
  transform: translateY(-50%) scale(1.1);
}

.auth-submode-btn {
  flex: 1;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-submode-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10B981;
}

.auth-link-forgot {
  font-size: 0.8rem;
  color: #10B981;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-weight: 600;
  transition: color 0.15s ease;
}

.auth-link-forgot:hover {
  color: #34D399;
}

.btn-oauth-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-oauth-google {
  background: #FFFFFF;
  color: #1f2937;
}

.btn-oauth-google:hover {
  background: #f3f4f6;
  transform: translateY(-1px);
}

.btn-oauth-apple {
  background: #000000;
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-oauth-apple:hover {
  background: #111111;
  transform: translateY(-1px);
}

.profile-discipline-chip {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.profile-discipline-chip.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--primary);
  color: #FFFFFF;
}

/* ==========================================================================
   VISTA CALENDARIO MENSUAL DE ENTRENAMIENTOS
   ========================================================================== */

.saved-calendar-view {
  background: #0E1524;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.calendar-header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.calendar-month-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0;
}

.calendar-weekdays-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

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

.calendar-day-cell {
  min-height: 72px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.calendar-day-cell:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}

.calendar-day-cell.other-month {
  opacity: 0.25;
  cursor: default;
}

.calendar-day-cell.today {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.06);
}

.calendar-day-cell.selected {
  border-color: #38BDF8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.calendar-day-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.calendar-day-cell.today .calendar-day-num {
  color: var(--primary);
  font-weight: 900;
}

.cal-day-badges-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.cal-day-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-day-badge.completed {
  background: rgba(16, 185, 129, 0.25);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.cal-day-badge.pending {
  background: rgba(56, 189, 248, 0.2);
  color: #38BDF8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.calendar-day-details {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 10px;
}

.calendar-day-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.4rem;
}

.calendar-day-details-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #10B981;
}

.btn-sm-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

/* ==========================================================================
   COMUNIDAD, FEED Y LEADERBOARD DE RETOS
   ========================================================================== */

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.leaderboard-row.my-row {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

.leaderboard-rank {
  font-weight: 800;
  width: 28px;
  font-size: 0.95rem;
}

.leaderboard-athlete {
  flex: 1;
  font-weight: 700;
  color: #FFFFFF;
}

.leaderboard-time {
  font-weight: 800;
  color: #F59E0B;
  font-family: monospace;
  font-size: 0.95rem;
}

.community-card {
  background: #111A2E;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.community-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.community-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.community-card-counters {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   EJECUTOR DE OTRAS IAs (BANNER & MODAL)
   ========================================================================== */

.external-ai-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 182, 212, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.external-ai-banner-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 250px;
}

.external-ai-banner-icon {
  font-size: 1.6rem;
  background: rgba(16, 185, 129, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.external-ai-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.15rem;
}

.external-ai-banner-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.external-step-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.external-step-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.external-step-badge {
  background: var(--primary);
  color: #000;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   PANEL HERO Y NAVEGACIÓN DE DÍAS EN PLANES (MES / SEMANA)
   ========================================================================== */

.plan-active-day-hero {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.plan-active-day-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent-cyan) 50%, var(--primary-light) 100%);
}

.plan-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.plan-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.18);
  color: var(--primary-light);
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  letter-spacing: 0.4px;
}

.plan-progress-pill {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.28);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}

.plan-hero-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin: 0.25rem 0 0.5rem 0;
}

.plan-hero-meta {
  display: flex;
  gap: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.plan-hero-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.plan-day-pills-nav-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1.25rem;
}

.plan-day-pills-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.plan-day-pills-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.plan-day-pills-nav {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  scrollbar-width: thin;
}

.plan-day-nav-pill {
  background: #111A2E;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  user-select: none;
}

.plan-day-nav-pill:hover {
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
}

.plan-day-nav-pill.active {
  background: rgba(6, 182, 212, 0.22);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.plan-day-nav-pill.completed {
  border-color: rgba(16, 185, 129, 0.5);
  color: #34D399;
  background: rgba(16, 185, 129, 0.12);
}

.plan-day-nav-pill.rest {
  border-style: dashed;
  opacity: 0.75;
}

/* ==========================================================================
   DIVISIÓN DE BLOQUES POR DISCIPLINA (HÍBRIDO CALISTENIA + GIMNASIA)
   ========================================================================== */

.discipline-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent-cyan);
  padding: 0.45rem 0.75rem;
  border-radius: 0 6px 6px 0;
  margin: 0.85rem 0 0.5rem 0;
}

.discipline-block-header.calistenia {
  border-left-color: #10B981;
}

.discipline-block-header.gimnasia {
  border-left-color: #8B5CF6;
}

.discipline-block-header.combate {
  border-left-color: #EF4444;
}

.discipline-block-header.running {
  border-left-color: #F59E0B;
}

.discipline-tag {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-discipline {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-left: 0.35rem;
  display: inline-flex;
  align-items: center;
}

.badge-discipline.calistenia {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.35);
}

.badge-discipline.gimnasia {
  background: rgba(139, 92, 246, 0.15);
  color: #A78BFA;
  border-color: rgba(139, 92, 246, 0.35);
}

.badge-discipline.combate {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.badge-discipline.running {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border-color: rgba(245, 158, 11, 0.35);
}

.cal-day-badge.plan-day {
  background: rgba(59, 130, 246, 0.2);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

/* ==========================================================================
   CALENDARIO INTERACTIVO DENTRO DE RUTINAS SEMANALES Y MENSUALES
   ========================================================================== */
.plan-inline-calendar-box {
  background: #0B1120;
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.plan-inline-cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.plan-inline-cal-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.plan-inline-cal-title h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #FFFFFF;
}

.plan-inline-cal-title .plan-cal-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.plan-cal-cell {
  position: relative;
  min-height: 80px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.plan-cal-cell.is-plan-day {
  background: rgba(6, 182, 212, 0.05);
  border-color: rgba(6, 182, 212, 0.25);
}

.plan-cal-cell.is-plan-day:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.plan-cal-cell.selected {
  border-color: var(--accent-cyan) !important;
  background: rgba(6, 182, 212, 0.18) !important;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.45);
}

.plan-cal-cell.completed {
  border-color: rgba(16, 185, 129, 0.5) !important;
  background: rgba(16, 185, 129, 0.09) !important;
}

.plan-cal-cell.completed.selected {
  border-color: #10B981 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.55);
}

.plan-cal-cell.rest-day {
  opacity: 0.75;
}

.plan-cal-day-chip {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.plan-cal-cell.completed .plan-cal-day-chip {
  color: #10B981;
}

.plan-cal-indicator-pill {
  font-size: 0.62rem;
  font-weight: 800;
  color: #06B6D4;
  background: rgba(6, 182, 212, 0.2);
  padding: 2px 4px;
  border-radius: 4px;
  margin-top: 4px;
  text-align: center;
}

.plan-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.plan-calendar-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.plan-calendar-legend .legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.plan-calendar-legend .legend-dot.completed { background: #10B981; }
.plan-calendar-legend .legend-dot.selected { background: var(--accent-cyan); }
.plan-calendar-legend .legend-dot.pending { background: #F59E0B; }
.plan-calendar-legend .legend-dot.rest { background: #64748B; }

.plan-selected-day-exercises-card {
  background: #0E1526;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.plan-selected-day-exercises-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.plan-selected-day-exercises-title h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================================
   CONTEXTO VISUAL EN EL TEMPORIZADOR (#timer-context-title)
   ============================================================================ */
.timer-context-title,
#timer-context-title {
  margin: 0 0 0.35rem 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-cyan, #38BDF8);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.3;
}

/* ============================================================================
   AJUSTES DE RESPONSIVIDAD (MOBILE FIRST)
   ============================================================================ */
@media (max-width: 768px) {
  .calendario-grid,
  .calendar-days-grid,
  .plan-dias-grid {
    grid-template-columns: 1fr; /* Pila vertical en móviles */
  }

  .calendar-weekdays-grid {
    display: none;
  }

  .modal-content,
  .modal-box,
  .modal-box-wide,
  .modal-box-routine-detail,
  .modal-perfil-container {
    width: 95%;
    max-width: 95%;
    padding: 15px;
  }

  .modal-perfil-grid {
    grid-template-columns: 1fr; /* Una sola columna en teléfonos */
  }

  .badges-container,
  .exercise-badges,
  .cal-day-badges-wrap,
  .routine-meta,
  .plan-quick-days-bar {
    flex-wrap: wrap;
  }
}



