/**
 * Estilos para Calculadora de tiempo de definición y déficit calórico
 * fijate.com/tools/calculadora-tiempo-definicion-grasa/
 */

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

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-sub: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

html[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #131b26;
  --bg-card-sub: #1a2433;
  --bg-input: #172130;
  --border-color: #243144;
  --border-focus: #60a5fa;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: rgba(59, 130, 246, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.6);
}

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,
.brand-title,
.section-title,
.card-title,
.faq-section-title {
  font-family: var(--font-heading);
  color: var(--text-main);
}

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

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

.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-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

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

.card-title-group h2 {
  font-size: 1.35rem;
  margin: 0;
  font-weight: 700;
}

/* Grid de Formulario de Parámetros */
.form-parameters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.15rem;
  background: var(--bg-card-sub);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control, .form-select {
  width: 100%;
  height: 42px;
  padding: 0 0.85rem;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select {
  padding-right: 2.2rem;
  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%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  appearance: none;
}

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

/* Selector Segmentado de Sexo */
.gender-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 42px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-input);
}

.gender-toggle-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.gender-toggle-group input[type="radio"] {
  display: none;
}

.gender-toggle-group input[type="radio"]:checked + .gender-toggle-label {
  background: var(--accent);
  color: #ffffff;
}

/* KPIs Principales */
.kpi-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.15rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}

.kpi-card.kpi-success::before {
  background: var(--success);
}

.kpi-card.kpi-warning::before {
  background: var(--warning);
}

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

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

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

/* Cuadrículas de Análisis Fisiológico */
.analysis-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .analysis-two-col {
    grid-template-columns: 1fr;
  }
}

.analysis-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.analysis-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  border-bottom: 1px dashed var(--border-color);
}

.data-row:last-child {
  border-bottom: none;
}

.data-label {
  color: var(--text-muted);
}

.data-val {
  font-weight: 700;
}

/* Sección de Macronutrientes */
.macros-section {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.macros-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
}

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

.macro-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.macro-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.macro-name {
  font-size: 0.9rem;
  font-weight: 700;
}

.macro-grams {
  font-size: 1.5rem;
  font-weight: 800;
}

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

.macro-bar-track {
  height: 8px;
  background: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.macro-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.fill-protein { background: #3b82f6; }
.fill-fat { background: #f59e0b; }
.fill-carb { background: #10b981; }

/* Caja de Refeed */
.refeed-box {
  background: rgba(59, 130, 246, 0.07);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.refeed-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.refeed-content h4 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.refeed-content p {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.refeed-meta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

/* Tabla del Cronograma Semanal */
.schedule-section {
  margin-top: 2rem;
}

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

.btn-secondary {
  min-height: 40px;
  padding: 0 1rem;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.schedule-wrapper.is-collapsed {
  display: none;
}

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

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.schedule-table th {
  background: var(--bg-card-sub);
  padding: 0.8rem 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.schedule-table td {
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--border-color);
}

.schedule-table tr:last-child td {
  border-bottom: none;
}

.badge-refeed {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Alertas de Seguridad */
.alert-box-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-main);
  font-size: 0.88rem;
}

.alert-box-warning ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.alert-box-warning li {
  margin-bottom: 0.35rem;
}

/* Acordeón Didáctico y FAQ */
.faq-section {
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
}

.faq-section-title {
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.faq-accordion details {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  padding: 0.85rem 1.15rem;
}

.faq-accordion summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-accordion summary::-webkit-details-marker {
  display: none;
}

.faq-accordion summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
}

.faq-accordion details[open] summary::after {
  content: '−';
}

.faq-accordion p {
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}
