/**
 * Calculadora de 1RM (Fuerza Máxima) y Zonas de Entrenamiento
 * Fijate Tools • CSS Modular Canónico
 */

/* ==========================================================================
   1. VARIABLES Y SISTEMA DE DISEÑO (TEMA OSCURO POR DEFECTO / TEMA CLARO)
   ========================================================================== */

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

  /* Paleta Midnight Slate (Oscuro) */
  --bg-page: #0b0f17;
  --bg-card: #111827;
  --bg-card-subtle: #182234;
  --bg-card-hover: #1e293b;
  --bg-input: #0e1524;
  --border-color: #243048;
  --border-focus: #6366f1;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;

  /* Acentos de estado y marcas */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.12);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;

  /* Colores de discos olímpicos IWF */
  --plate-25: #dc2626; /* Rojo */
  --plate-20: #2563eb; /* Azul */
  --plate-15: #eab308; /* Amarillo */
  --plate-10: #16a34a; /* Verde */
  --plate-5: #f1f5f9;  /* Blanco */
  --plate-2-5: #334155; /* Negro */
  --plate-1-25: #94a3b8; /* Cromo */

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.45);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Claro Canónico */
[data-theme="light"],
body.light-theme {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --border-focus: #4f46e5;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --primary-light: rgba(99, 102, 241, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   2. ESTRUCTURA Y RESET BASE
   ========================================================================== */

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

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

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

.mono,
.hero-value,
.hero-unit,
.detail-val,
.target-val,
.zone-weight-box,
code {
  font-family: var(--font-mono);
}

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

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

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

.card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-top: 1rem;
}

/* ==========================================================================
   3. INTRODUCCIÓN Y ENCABEZADOS DE SECCIÓN
   ========================================================================== */

.tool-intro-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.intro-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: var(--primary-light);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.tool-section-heading {
  font-size: 1.875rem;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.tool-intro-text {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 900px;
}

/* Subsecciones */
.tool-sub-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

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

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

.sub-section-subtitle {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ==========================================================================
   4. WORKSPACE EN 2 COLUMNAS (FORMULARIO Y HERO DE RESULTADOS)
   ========================================================================== */

.rm-workspace {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.75rem;
  align-items: stretch;
}

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

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  font-weight: 600;
}

.panel-badge-live {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   5. CONTROLES DE FORMULARIO RESPONSIVOS
   ========================================================================== */

.rm-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.form-row-dual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

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

.label-with-hint {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

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

/* Desplegables con el estándar de corte y flecha */
.select-wrapper {
  position: relative;
  width: 100%;
}

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

.form-select:focus,
.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* Control Segmentado (kg / lb) */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  min-height: 42px;
}

.segment-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.segment-btn.active {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* Inputs con stepper +/- */
.input-with-stepper {
  display: flex;
  align-items: stretch;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 42px;
}

.input-with-stepper input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-main);
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  outline: none;
}

.btn-step {
  width: 44px;
  min-width: 44px;
  background-color: var(--bg-card);
  border: none;
  color: var(--text-main);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-step:hover {
  background-color: var(--bg-card-hover);
  color: var(--primary);
}

/* Presets rápidos de peso */
.quick-presets {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.btn-preset {
  flex: 1 1 0%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn-preset:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Chips de repeticiones */
.reps-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.chip-rep {
  flex: 1 1 calc(14% - 0.35rem);
  min-width: 38px;
  height: 34px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-rep:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chip-rep.active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Sección de RPE avanzada */
.advanced-section {
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  background-color: rgba(0, 0, 0, 0.1);
}

.btn-toggle-advanced {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.badge-optional {
  margin-left: auto;
  font-size: 0.6875rem;
  color: var(--text-subtle);
  background-color: var(--bg-card);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.chevron-icon {
  transition: transform 0.2s ease;
}

.btn-toggle-advanced[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

.advanced-content {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
}

.advanced-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Botones de acción del formulario */
.form-actions-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-primary-action,
.btn-secondary-action,
.btn-danger-action {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  padding: 0.65rem 1.25rem;
  border: 1px solid transparent;
}

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

.btn-primary-action:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

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

.btn-secondary-action:hover {
  background-color: var(--bg-card-hover);
}

.btn-danger-action {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger-action:hover {
  background-color: #dc2626;
}

/* ==========================================================================
   6. HERO DE RESULTADOS (COLUMNA 2)
   ========================================================================== */

.hero-result-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(14, 165, 233, 0.08) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 1.75rem 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

.hero-caption {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.hero-val-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.hero-value {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
}

[data-theme="light"] .hero-value,
body.light-theme .hero-value {
  color: #0f172a;
}

.hero-unit {
  font-size: 1.5rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hero-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  padding-top: 1rem;
  margin-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .hero-details,
body.light-theme .hero-details {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.hero-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.detail-label {
  font-size: 0.6875rem;
  color: var(--text-subtle);
  text-transform: uppercase;
}

.detail-val {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Tarjetas rápidas de cargas (90%, 80%, 70%) */
.quick-targets-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.quick-target-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.75rem;
  text-align: center;
  transition: var(--transition);
}

.quick-target-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.target-pct {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  margin-bottom: 0.25rem;
}

.target-strength .target-pct { color: #f43f5e; }
.target-hypertrophy .target-pct { color: #3b82f6; }
.target-endurance .target-pct { color: #10b981; }

.target-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

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

.hero-action-footer {
  margin-top: auto;
  text-align: center;
}

.btn-link-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-link-action:hover {
  background-color: var(--primary-light);
}

/* ==========================================================================
   7. SECCIÓN 2: COMPARATIVA DE LAS 7 FÓRMULAS CIENTÍFICAS
   ========================================================================== */

.btn-info-modal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-info-modal:hover {
  color: var(--primary);
  border-color: var(--primary);
}

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

.formula-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.formula-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.formula-card.is-active-formula {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--bg-card-subtle) 0%, rgba(99, 102, 241, 0.08) 100%);
}

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

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

.formula-year {
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-weight: 500;
}

.formula-val-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.formula-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
}

.formula-diff {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

.diff-positive {
  background-color: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.diff-negative {
  background-color: rgba(14, 165, 233, 0.12);
  color: var(--info);
}

.diff-neutral {
  background-color: rgba(156, 163, 175, 0.12);
  color: var(--text-muted);
}

.formula-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  line-height: 1.4;
  flex: 1 0 auto;
}

.btn-select-formula {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  width: 100%;
}

.btn-select-formula:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.formula-card.is-active-formula .btn-select-formula {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ==========================================================================
   8. SECCIÓN 3: ZONAS DE ENTRENAMIENTO FISIOLÓGICAS
   ========================================================================== */

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

.zone-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  border-top-width: 4px;
}

.zone-neural { border-top-color: #ef4444; }
.zone-strength-heavy { border-top-color: #f97316; }
.zone-hypertrophy { border-top-color: #3b82f6; }
.zone-endurance-strength { border-top-color: #10b981; }
.zone-warmup { border-top-color: #8b5cf6; }

.zone-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.zone-neural .zone-badge { color: #ef4444; }
.zone-strength-heavy .zone-badge { color: #f97316; }
.zone-hypertrophy .zone-badge { color: #3b82f6; }
.zone-endurance-strength .zone-badge { color: #10b981; }
.zone-warmup .zone-badge { color: #8b5cf6; }

.zone-title {
  font-size: 1rem;
  line-height: 1.3;
  margin-bottom: 0.65rem;
}

.zone-weight-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  margin-bottom: 0.85rem;
}

.zone-specs {
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: auto;
}

.zone-specs li {
  line-height: 1.35;
}

.zone-specs strong {
  color: var(--text-main);
}

/* ==========================================================================
   9. SECCIÓN 4: TABLA COMPLETA DE PORCENTAJES
   ========================================================================== */

.table-responsive-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card-subtle);
}

.rm-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.rm-data-table th,
.rm-data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.rm-data-table th {
  background-color: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.rm-data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.rm-data-table tbody tr:last-child td {
  border-bottom: none;
}

.badge-row-zone {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.btn-table-load {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

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

/* ==========================================================================
   10. SECCIÓN 5: CALCULADORA DE DISCOS Y BARRA (PLATE CALCULATOR)
   ========================================================================== */

.plate-calc-container {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.plate-controls-bar {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.inline-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.input-target-wrap {
  display: flex;
  align-items: stretch;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-target-wrap input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-main);
  padding: 0.65rem 0.85rem;
  font-size: 1.1rem;
  font-weight: 700;
  outline: none;
}

.unit-addon {
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  background-color: var(--bg-card);
  border-left: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.875rem;
}

/* Visualizador de Barra */
.barbell-visualizer {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  min-height: 180px;
}

.barbell-sleeve-area {
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 1rem;
}

.barbell-shaft {
  width: 140px;
  height: 26px;
  background: linear-gradient(180deg, #94a3b8 0%, #475569 50%, #1e293b 100%);
  border-radius: 4px 0 0 4px;
  border-right: none;
}

.barbell-collar {
  width: 24px;
  height: 70px;
  background: linear-gradient(180deg, #cbd5e1 0%, #64748b 50%, #334155 100%);
  border-radius: 4px;
  box-shadow: 2px 0 6px rgba(0,0,0,0.4);
  z-index: 2;
}

.barbell-sleeve {
  height: 48px;
  min-width: 220px;
  background: linear-gradient(180deg, #e2e8f0 0%, #94a3b8 50%, #475569 100%);
  display: flex;
  align-items: center;
  padding-left: 2px;
  position: relative;
  border-radius: 0 4px 4px 0;
  gap: 2px;
}

/* Discos SVG / Bloques */
.plate-disc {
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 800;
  writing-mode: vertical-lr;
  text-orientation: mixed;
  transform: rotate(180deg);
  box-shadow: 1px 0 4px rgba(0,0,0,0.3);
  user-select: none;
  transition: transform 0.2s ease;
}

.plate-disc:hover {
  transform: rotate(180deg) scale(1.04);
}

.plate-25kg { width: 34px; height: 160px; background-color: var(--plate-25); }
.plate-20kg { width: 32px; height: 150px; background-color: var(--plate-20); }
.plate-15kg { width: 30px; height: 135px; background-color: var(--plate-15); color: #000; }
.plate-10kg { width: 28px; height: 120px; background-color: var(--plate-10); }
.plate-5kg { width: 24px; height: 95px; background-color: var(--plate-5); color: #000; border: 1px solid #cbd5e1; }
.plate-2-5kg { width: 20px; height: 75px; background-color: var(--plate-2-5); }
.plate-1-25kg { width: 16px; height: 60px; background-color: var(--plate-1-25); color: #000; }

/* Desglose de discos */
.plate-breakdown-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.breakdown-title {
  font-size: 0.75rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  font-weight: 600;
}

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

.breakdown-chips-list {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.plate-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
}

.plate-pill.p-25 { background-color: var(--plate-25); }
.plate-pill.p-20 { background-color: var(--plate-20); }
.plate-pill.p-15 { background-color: var(--plate-15); color: #000; }
.plate-pill.p-10 { background-color: var(--plate-10); }
.plate-pill.p-5 { background-color: var(--plate-5); color: #000; border: 1px solid #cbd5e1; }
.plate-pill.p-2-5 { background-color: var(--plate-2-5); }
.plate-pill.p-1-25 { background-color: var(--plate-1-25); color: #000; }

/* ==========================================================================
   11. SECCIÓN 6: HISTORIAL DE MARCAS GUARDADAS
   ========================================================================== */

.history-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-outline-action,
.btn-outline-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: transparent;
  border: 1px solid var(--border-color);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  min-height: 38px;
}

.btn-outline-action {
  color: var(--text-main);
}

.btn-outline-action:hover {
  background-color: var(--bg-card-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline-danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-outline-danger:hover {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}

.empty-history-box {
  text-align: center;
  padding: 3rem 1.5rem;
  background-color: var(--bg-card-subtle);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.empty-history-icon {
  margin-bottom: 0.75rem;
  color: var(--text-subtle);
}

/* ==========================================================================
   12. SECCIÓN 7: PREGUNTAS FRECUENTES (FAQ)
   ========================================================================== */

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

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

.faq-question {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.faq-question:hover {
  background-color: var(--bg-card-hover);
  color: var(--primary);
}

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

.faq-answer strong {
  color: var(--text-main);
}

/* ==========================================================================
   13. MODALES CANÓNICOS (CERO ALERT)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

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

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
  font-size: 1.2rem;
}

.btn-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 0.9375rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.formula-expl-item {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.formula-expl-item h4 {
  font-size: 0.9375rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.formula-expl-item code {
  display: block;
  background-color: var(--bg-input);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  margin: 0.35rem 0;
  color: var(--primary);
  font-size: 0.8125rem;
}

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

/* ==========================================================================
   14. VISTA DE IMPRESIÓN OFICIAL A4 (.print-sheet)
   ========================================================================== */

.print-sheet {
  display: none;
}

@media print {
  /* Ocultar interfaz web y anuncios */
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .main-wrapper,
  .fijate-footer,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .modal-overlay {
    display: none !important;
  }

  .print-sheet {
    display: block !important;
    max-width: 210mm;
    margin: 0 auto;
    padding: 15mm;
    font-family: 'Inter', system-ui, sans-serif;
    color: #111827;
    background: #ffffff;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #000000;
    padding-bottom: 8mm;
    margin-bottom: 8mm;
  }

  .print-brand h2 {
    font-size: 16pt;
    margin-bottom: 2mm;
  }

  .print-brand p {
    font-size: 10pt;
    color: #4b5563;
  }

  .print-meta {
    text-align: right;
    font-size: 9pt;
  }

  .print-section {
    margin-bottom: 8mm;
  }

  .print-section h3 {
    font-size: 11pt;
    margin-bottom: 3mm;
    border-bottom: 1px solid #d1d5db;
    padding-bottom: 1.5mm;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
  }

  .print-table th,
  .print-table td {
    padding: 2mm 3mm;
    border: 1px solid #d1d5db;
    text-align: left;
  }

  .print-table th {
    background-color: #f3f4f6;
    font-weight: 600;
  }

  .print-table-sm th,
  .print-table-sm td {
    padding: 1.5mm 2.5mm;
    font-size: 8.5pt;
  }

  .print-highlight {
    font-size: 11pt;
    color: #1e40af;
  }

  .print-signatures {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20mm;
    margin-top: 15mm;
    margin-bottom: 10mm;
  }

  .signature-box {
    text-align: center;
  }

  .signature-line {
    border-bottom: 1px solid #000000;
    margin-bottom: 3mm;
    height: 15mm;
  }

  .signature-box p {
    font-size: 8.5pt;
    color: #374151;
  }

  .print-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 4mm;
    font-size: 8pt;
    color: #6b7280;
    text-align: center;
  }
}

/* ==========================================================================
   15. RESPONSIVIDAD Y OPTIMIZACIONES MÓVILES
   ========================================================================== */

@media (max-width: 992px) {
  .rm-workspace {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .plate-controls-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .card-main {
    padding: 1.25rem 1rem;
  }

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

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

  .hero-value {
    font-size: 2.75rem;
  }

  .hero-details {
    grid-template-columns: 1fr;
    text-align: left;
    gap: 0.35rem;
  }

  .hero-detail-item {
    flex-direction: row;
    justify-content: space-between;
  }

  .quick-targets-grid {
    grid-template-columns: 1fr;
  }

  .barbell-visualizer {
    padding: 1.5rem 0.5rem;
  }

  .barbell-shaft {
    width: 60px;
  }

  .barbell-sleeve {
    min-width: 170px;
  }

  .history-actions {
    width: 100%;
  }

  .btn-outline-action,
  .btn-outline-danger {
    flex: 1 1 100%;
    justify-content: center;
  }
}
