/* ==========================================================================
   Calculadora de dosis de creatina y saturación muscular - Estilos
   ========================================================================== */

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

  /* Tema claro por defecto */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-card: #e2e8f0;
  --border-subtle: #cbd5e1;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-strong: #0284c7;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;

  --accent-amber: #d97706;
  --accent-amber-light: #fef3c7;
  --accent-green: #16a34a;
  --accent-green-light: #dcfce7;
  --accent-blue: #0284c7;
  --accent-cyan: #06b6d4;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #131b2b;
  --bg-card-subtle: #1a2438;
  --bg-input: #0f172a;
  --border-card: #24324d;
  --border-subtle: #334155;
  --border-focus: #38bdf8;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-strong: #38bdf8;

  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-light: rgba(56, 189, 248, 0.12);

  --accent-amber: #fbbf24;
  --accent-amber-light: rgba(251, 191, 36, 0.15);
  --accent-green: #4ade80;
  --accent-green-light: rgba(74, 222, 128, 0.15);
  --accent-blue: #38bdf8;
  --accent-cyan: #22d3ee;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
}

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

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

h1, h2, h3, h4, h5, h6,
.section-title,
.hero-title,
.faq-section-title,
.brand-title {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.mono {
  font-family: var(--font-mono);
}

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

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

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

/* Tarjeta principal */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

/* Encabezado interno de la herramienta */
.tool-intro {
  margin-bottom: 1.75rem;
}

.tool-intro h2 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.tool-intro p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

/* Grid de configuración / entradas */
.inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.input-group {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.input-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.input-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Stepper de peso */
.stepper-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stepper-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.stepper-input-box {
  position: relative;
  flex: 1 1 0%;
}

.stepper-input-box input {
  width: 100%;
  height: 44px;
  padding: 0 2.2rem 0 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 1.15rem;
  font-family: var(--font-mono);
  font-weight: 600;
}

.stepper-unit {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: none;
}

/* Interruptor de composición corporal */
.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-subtle);
  transition: 0.25s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.fat-slider-box {
  margin-top: 0.75rem;
}

.fat-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.fat-val-label {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
}

.range-input {
  width: 100%;
  accent-color: var(--primary);
  height: 6px;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* Selectores */
.form-select {
  width: 100%;
  height: 44px;
  padding: 0 2.5rem 0 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-size: 0.95rem;
  cursor: pointer;
  appearance: none;
  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='%2364748b' 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.8rem center;
}

/* Tarjetas de selección de protocolo */
.protocol-selection-area {
  margin-bottom: 1.75rem;
}

.protocol-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.6rem;
}

.protocol-choice-card {
  border: 2px solid var(--border-card);
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  user-select: none;
}

.protocol-choice-card:hover {
  border-color: var(--primary);
}

.protocol-choice-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

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

.protocol-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.protocol-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-weight: 600;
}

.protocol-tag.fast {
  background: var(--accent-amber-light);
  color: var(--accent-amber);
}

.protocol-tag.linear {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.protocol-summary-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* HERO BANNER DE RESULTADOS */
.results-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

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

.hero-stat-card.featured {
  background: linear-gradient(135deg, var(--bg-card-subtle) 0%, var(--primary-light) 100%);
  border-color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.stat-value .unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-value .sub-kpi {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  margin-top: 0.2rem;
}

.stat-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* Pastillas de composición corporal */
.body-composition-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px dashed var(--border-card);
}

.composition-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pill-dot.green { background-color: var(--accent-green); }
.pill-dot.amber { background-color: var(--accent-amber); }

.pill-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Banner de desglose de protocolo */
.protocol-summary-banner {
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
  border-left: 4px solid var(--primary);
}

.protocol-summary-banner.loading-mode {
  background: var(--accent-amber-light);
  border-left-color: var(--accent-amber);
}

.protocol-summary-banner.continuous-mode {
  background: var(--primary-light);
  border-left-color: var(--primary);
}

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

.badge-protocol {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.badge-target {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.protocol-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 0.5rem;
  color: var(--text-main);
}

.protocol-next-phase {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.85rem;
}

.badge-next {
  font-weight: 700;
  color: var(--text-main);
  display: block;
  margin-bottom: 0.2rem;
}

/* Sección de hidratación */
.hydration-section {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
}

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

.hydration-header h3 {
  font-size: 1.1rem;
  margin: 0;
}

.water-bar-wrapper {
  height: 14px;
  background: var(--border-card);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.water-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
  border-radius: 8px;
  transition: width 0.4s ease;
}

.water-breakdown-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.85rem;
}

.water-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.water-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.water-dot.blue { background-color: #0284c7; }
.water-dot.cyan { background-color: #38bdf8; }

/* Cronograma horario */
.timeline-section {
  margin-bottom: 1.75rem;
}

.timeline-section h3 {
  font-size: 1.15rem;
  margin: 0 0 0.85rem;
}

.timeline-grid {
  display: grid;
  gap: 0.75rem;
}

.timeline-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
}

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

.timeline-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
}

.timeline-time {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.timeline-dose {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-strong);
}

.timeline-food {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

/* Gráfico de saturación */
.chart-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
}

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

.chart-header h3 {
  font-size: 1.1rem;
  margin: 0;
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.saturation-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-card);
  font-size: 0.85rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
}

.legend-item.active {
  color: var(--text-main);
  font-weight: 600;
}

.legend-line {
  width: 20px;
  height: 4px;
  border-radius: 2px;
}

/* Sección FAQ / Desmitificación */
.faq-section {
  margin-top: 2rem;
}

.faq-title {
  font-size: 1.35rem;
  margin: 0 0 1rem;
  font-weight: 700;
}

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

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

.faq-question {
  width: 100%;
  text-align: left;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

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

  .card-main {
    padding: 1.25rem;
  }

  .protocol-cards-grid {
    grid-template-columns: 1fr;
  }

  .results-hero-grid {
    grid-template-columns: 1fr 1fr;
  }

  .water-breakdown-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .chart-legend {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .results-hero-grid {
    grid-template-columns: 1fr;
  }

  .stepper-container {
    flex-wrap: nowrap;
  }
}
