/* ==========================================================================
   Guía de ajuste de SAG y puesta a punto de suspensiones MTB - Fijate Tools
   ========================================================================== */

: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 por defecto) */
  --bg-body: #0b0f17;
  --bg-card: #131b26;
  --bg-card-subtle: #182333;
  --bg-input: #1a2536;
  --bg-input-hover: #223046;
  --border-color: #233147;
  --border-light: #2d3f5a;

  --primary-color: #0284c7;
  --primary-light: #38bdf8;
  --primary-hover: #0369a1;
  --kashima-gold: #d97706;
  --kashima-light: #fbbf24;
  --kashima-bg: rgba(217, 119, 6, 0.12);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-success: #10b981;
  --accent-success-bg: rgba(16, 185, 129, 0.15);
  --accent-warning: #f59e0b;
  --accent-warning-bg: rgba(245, 158, 11, 0.15);
  --accent-danger: #ef4444;
  --accent-danger-bg: rgba(239, 68, 68, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --transition-fast: 0.18s ease;
}

[data-theme="light"],
body.light-theme {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #f8fafc;
  --bg-input-hover: #f1f5f9;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;

  --primary-color: #0284c7;
  --primary-light: #0369a1;
  --primary-hover: #075985;
  --kashima-gold: #b45309;
  --kashima-light: #d97706;
  --kashima-bg: rgba(217, 119, 6, 0.08);

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

  --shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.08);
}

/* Tipografía base */
body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.hero-title,
.tab-btn,
.panel-title {
  font-family: var(--font-heading);
}

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

/* Contenedor principal de la herramienta */
.card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .card-main {
    padding: 1rem;
    border-radius: var(--radius-md);
  }
}

/* Barra de pestañas (Tabs) */
.tool-tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tool-tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  background: var(--bg-input-hover);
  color: var(--text-main);
  border-color: var(--border-light);
}

.tab-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-light);
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
}

.tab-btn svg {
  flex-shrink: 0;
}

/* Presets rápidos de disciplina */
.discipline-quick-bar {
  margin-bottom: 1.25rem;
}
.quick-bar-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.discipline-buttons-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (max-width: 640px) {
  .discipline-buttons-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.btn-discipline-preset {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 0.55rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  line-height: 1.25;
  transition: all var(--transition-fast);
}
.btn-discipline-preset small {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}
.btn-discipline-preset:hover {
  border-color: var(--primary-light);
  background: var(--bg-input-hover);
}
.btn-discipline-preset.active {
  background: rgba(2, 132, 199, 0.15);
  border-color: var(--primary-light);
  color: var(--primary-light);
}
.btn-discipline-preset.active small {
  color: var(--text-main);
}

/* Workspace de 2 columnas (Formulario a la izquierda, Visualizador/Resultados a la derecha) */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

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

/* Cajas de formulario y paneles */
.panel-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.panel-box:last-child {
  margin-bottom: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}
.panel-title svg {
  color: var(--primary-light);
  flex-shrink: 0;
}

/* Form controls adaptados canónicamente */
.form-group {
  margin-bottom: 1rem;
}
.form-group:last-child {
  margin-bottom: 0;
}
.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}
.form-label-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary-light);
}

/* Desplegables <select> conforme a reglas fijate */
select.form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 42px;
  min-height: 40px;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 40px 0 0.85rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  appearance: none;
  -webkit-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='%2394a3b8' 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 14px center;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
select.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
}
select.form-control option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* Inputs numéricos y sliders sincronizados */
.input-with-slider {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.input-wrapper-flex {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 42px;
  min-height: 40px;
}
.input-wrapper-flex:focus-within {
  border-color: var(--primary-light);
}
.input-wrapper-flex input[type="number"] {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  padding: 0 0.75rem;
  outline: none;
}
.input-suffix {
  padding: 0 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border-color);
  user-select: none;
}

/* Sliders de rango estéticos */
input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  margin: 0.35rem 0;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform var(--transition-fast);
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Conmutador de unidades (kg / lbs) */
.unit-toggle-group {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.btn-unit-toggle {
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-unit-toggle.active {
  background: var(--primary-color);
  color: #ffffff;
}

/* Grupos de opciones compactos (Feel / Tacto) */
.options-compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (max-width: 480px) {
  .options-compact-grid {
    grid-template-columns: 1fr;
  }
}
.option-radio-card {
  position: relative;
}
.option-radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.option-radio-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.4rem;
  min-height: 48px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.option-radio-card input[type="radio"]:checked + .option-radio-label {
  border-color: var(--primary-light);
  background: rgba(2, 132, 199, 0.15);
  color: var(--primary-light);
}

/* Checkbox estilizado */
.custom-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}
.custom-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
  cursor: pointer;
}

/* ==========================================================================
   Visualizador SVG interactivo de Horquilla y Amortiguador
   ========================================================================== */
.suspension-visualizer-container {
  display: flex;
  gap: 1rem;
  justify-content: center;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 480px) {
  .suspension-visualizer-container {
    flex-direction: column;
    align-items: center;
  }
}

.visualizer-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 220px;
}
.visualizer-heading {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.visualizer-svg-wrap {
  width: 100%;
  max-width: 180px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
}
.visualizer-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Tarjetas de resultados de setup */
.result-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.result-component-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}
.result-component-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-light);
}
.result-component-card.shock-card::before {
  background: var(--kashima-gold);
}

.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.6rem;
}
.result-component-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}
.result-badge-kashima {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--kashima-light);
  background: var(--kashima-bg);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.result-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (max-width: 480px) {
  .result-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}
.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}
.metric-val-main {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}
.metric-val-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

.result-notice-box {
  margin-top: 0.85rem;
  background: rgba(2, 132, 199, 0.1);
  border: 1px solid rgba(2, 132, 199, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--primary-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Botones de acción general (Copiar, Imprimir, Compartir) */
.actions-buttons-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (max-width: 640px) {
  .actions-buttons-bar {
    grid-template-columns: 1fr;
  }
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 42px;
  min-height: 40px;
  padding: 0 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: 1px solid transparent;
  width: 100%;
}
.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-light);
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-secondary {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-input-hover);
  border-color: var(--border-light);
}

/* Tab 2: Diagnóstico con semáforos */
.diagnose-component-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.status-success {
  background: var(--accent-success-bg);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-warning {
  background: var(--accent-warning-bg);
  color: var(--accent-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-danger {
  background: var(--accent-danger-bg);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.advice-box {
  background: var(--bg-input);
  border-left: 3px solid var(--primary-light);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.45;
  margin-top: 0.75rem;
}

/* Tab 3: Troubleshooting de problemas */
.trouble-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}
.trouble-section-block {
  margin-bottom: 1rem;
}
.trouble-label-sub {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
  display: block;
}
.label-wrong {
  color: var(--accent-danger);
}
.label-correct {
  color: var(--accent-success);
}
.block-wrong {
  background: var(--accent-danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.88rem;
  color: #fca5a5;
}
.block-correct {
  background: var(--accent-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.88rem;
  color: #6ee7b7;
}

/* Tab 4: Guía de medición paso a paso */
.guide-steps-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.guide-step-card {
  display: flex;
  gap: 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.step-number-badge {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary-color);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
}
.step-content-body h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--text-main);
}
.step-content-body p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Modales canónicos fijate */
.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: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.modal-header {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}
.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  min-height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.btn-close-modal:hover {
  color: var(--text-main);
  background: var(--bg-card-subtle);
}
.modal-body {
  padding: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.modal-body p {
  margin: 0 0 0.75rem;
  color: var(--text-main);
}
.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ==========================================================================
   Impresión documental A4 (.print-sheet)
   ========================================================================== */
.print-sheet {
  display: none;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-header,
  .fijate-footer,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .card-main,
  .seo-guide-section {
    display: none !important;
  }
  .print-sheet {
    display: block !important;
    max-width: 210mm;
    margin: 0 auto;
    padding: 15mm;
    font-size: 11pt;
    line-height: 1.4;
  }
  .print-header {
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
  }
  .print-header h2 {
    margin: 0;
    font-size: 16pt;
  }
  .print-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .print-box {
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 4px;
    page-break-inside: avoid;
  }
  .print-box h4 {
    margin: 0 0 8px;
    font-size: 12pt;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
  }
  .print-table {
    width: 100%;
    border-collapse: collapse;
  }
  .print-table td {
    padding: 4px 6px;
    font-size: 10pt;
  }
}
