/* Calculadora de potencial muscular y límite natural - Estilos */
:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.12);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  --bg-main: #0b0f17;
  --card-bg: #111827;
  --bg-card-header: #1f2937;
  --bg-input: #1e293b;
  --border-color: #374151;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --table-stripe: #162032;
  --radius-lg: 12px;
  --radius-md: 8px;
  --transition: all 0.2s ease;
}

[data-theme="light"] {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.08);
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --bg-card-header: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --table-stripe: #f8fafc;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  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,
.results-heading,
.methodology-title {
  font-family: var(--font-heading);
}

.mono,
.kpi-value,
.meta-val,
.step-gain,
code {
  font-family: var(--font-mono);
}

/* Layout */
.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%;
}

/* Card principal */
.card-main {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  margin-bottom: 2rem;
}

.intro-box {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--text-main);
  line-height: 1.25;
}

.section-intro {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
  margin: 0;
}

/* Formulario */
.tool-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.form-grid.mini-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

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

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

.label-hint {
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-suffix input,
.form-select,
.mini-grid input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  min-height: 42px;
  transition: var(--transition);
}

.input-with-suffix input {
  padding-right: 2.8rem;
}

.input-with-suffix input:focus,
.form-select:focus,
.mini-grid input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-suffix {
  position: absolute;
  right: 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
  font-family: var(--font-mono);
}

.form-select {
  font-family: var(--font-main);
  cursor: pointer;
}

/* Panel opcional desplegable */
.optional-toggle-area {
  border-top: 1px dashed var(--border-color);
  padding-top: 1rem;
}

.btn-toggle-optional {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  min-height: 40px;
}

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

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

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

.current-stats-panel {
  background: var(--bg-card-header);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.current-stats-panel[hidden] {
  display: none;
}

.panel-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}

.girths-current-subgrid {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.subgrid-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 0.75rem;
}

/* Botones de acción */
.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 46px;
  transition: var(--transition);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 46px;
  transition: var(--transition);
}

.btn-secondary:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

/* Zona de resultados */
.results-container {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.results-heading {
  font-size: 1.35rem;
  margin: 0 0 1.5rem;
  color: var(--text-main);
}

/* KPI Banner */
.kpi-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-item {
  background: var(--bg-card-header);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.kpi-item.highlight {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

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

/* Barra de progreso */
.progress-card {
  background: var(--bg-card-header);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.progress-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.progress-percent {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
}

.progress-track {
  height: 12px;
  background: var(--bg-main);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.88rem;
}

.meta-item {
  display: flex;
  gap: 0.4rem;
}

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

.meta-val {
  font-weight: 600;
  color: var(--text-main);
}

.meta-val.highlight-green {
  color: var(--success-color);
}

/* Semáforo card */
.status-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card-header);
  margin-bottom: 2rem;
  transition: var(--transition);
}

.status-card.status-green {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.status-card.status-yellow {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}

.status-card.status-orange {
  border-color: rgba(249, 115, 22, 0.4);
  background: rgba(249, 115, 22, 0.08);
}

.status-card.status-red {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.status-icon-box {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.2rem;
}

.status-green .status-icon-box {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.status-yellow .status-icon-box {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.status-orange .status-icon-box {
  background: rgba(249, 115, 22, 0.2);
  color: #f97316;
}

.status-red .status-icon-box {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.status-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

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

/* Tabla de medidas */
.measurements-section {
  margin-bottom: 2rem;
}

.sub-heading {
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
}

.sub-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

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

.measurements-table th {
  background: var(--bg-card-header);
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

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

.measurements-table tr:nth-child(even) {
  background: var(--table-stripe);
}

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

.diff-positive {
  color: var(--success-color);
  font-weight: 600;
}

.diff-neutral {
  color: var(--text-muted);
}

/* Timeline */
.trajectory-card {
  background: var(--bg-card-header);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

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

.step-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.step-rate {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.step-gain {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.step-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Metodología y FAQ */
.methodology-card {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.accordion-item {
  margin-bottom: 1.25rem;
}

.accordion-header {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
  color: var(--text-main);
  font-weight: 600;
}

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

/* Adaptación responsive */
@media (max-width: 768px) {
  .card-main {
    padding: 1.25rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }

  .kpi-banner {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-value {
    font-size: 1.6rem;
  }
}

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