/* =================================================================
   Valorador de motos — panel de instrumentos
   Negro casi puro + rojo de carrera como único acento. Tipografía
   condensada para títulos (estilo placa/cuentavueltas) y monoespaciada
   para todos los datos numéricos (precios, km, cv), como un display
   digital de cuadro de mando.
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders:wght@600;700;800&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --black: #0B0B0C;
  --charcoal: #17171A;
  --hairline: #2B2B2F;
  --paper: #F5F4F1;
  --ash: #9B9B9F;
  --red: #E10600;
  --red-bright: #FF3B30;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

html, body {
  margin: 0;
  background: var(--black);
  color: var(--paper);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px 90px;
}

a { color: var(--red-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--red-bright);
  outline-offset: 2px;
}

h1, h2 { font-family: 'Big Shoulders', sans-serif; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 38px 0 18px;
  border-bottom: 2px solid var(--red);
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 11px;
  height: 11px;
  background: var(--red);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.brand h1 {
  font-weight: 800;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}
.brand-dot { color: var(--red); }

.topbar-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  color: var(--ash);
  letter-spacing: 0.02em;
  flex: 1 1 220px;
}

.pct-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--charcoal);
  border: 1px solid var(--hairline);
  padding: 8px 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
}
.pct-chip label { color: var(--ash); white-space: nowrap; }
.pct-chip input {
  width: 52px;
  background: var(--black);
  border: 1px solid var(--hairline);
  color: var(--paper);
  padding: 4px 6px;
  font-family: inherit;
  font-size: inherit;
}
.pct-chip button {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red-bright);
  padding: 4px 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pct-chip button:hover { background: var(--red); color: var(--paper); }
.pct-status { color: var(--ash); font-size: 0.7rem; min-width: 64px; }

/* ---------- Paneles ---------- */
.panel {
  background: var(--charcoal);
  border: 1px solid var(--hairline);
  padding: 28px;
  margin-top: 24px;
}

.panel-error { border-color: var(--red); }
.panel-error strong { color: var(--red-bright); }
.panel-error p { margin: 6px 0 0; }

/* ---------- Formulario ---------- */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}
.field-grid--four { grid-template-columns: repeat(4, 1fr); margin-top: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ash);
}

.field select, .field input {
  background: var(--black);
  border: 1px solid var(--hairline);
  color: var(--paper);
  padding: 10px 12px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.92rem;
}
.field select:focus, .field input:focus { border-color: var(--red); }
.field select:disabled { color: var(--ash); }

.form-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--red);
  color: var(--paper);
  border: none;
  padding: 13px 30px;
  font-family: 'Big Shoulders', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--red-bright); }
.btn-primary:disabled { background: var(--hairline); color: var(--ash); cursor: not-allowed; }

.hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.74rem;
  color: var(--ash);
  margin: 0;
}

/* ---------- Panel de estado en vivo ---------- */
.status-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--black);
  border: 1px solid var(--red);
  border-left: 3px solid var(--red);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red-bright);
  flex-shrink: 0;
  animation: status-pulse 1.1s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .status-dot { animation: none; }
}
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.status-texto {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  color: var(--paper);
}

/* ---------- Resultados ---------- */
.results-head h2 {
  font-weight: 800;
  text-transform: uppercase;
  font-size: 1.55rem;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}
.results-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--ash);
  margin: 3px 0;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--hairline);
  margin-top: 28px;
  border: 1px solid var(--hairline);
}
.stat {
  background: var(--charcoal);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ash);
}
.stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.65rem;
  font-weight: 500;
}
.stat--compra .stat-value { color: var(--red-bright); }
.stat-sub {
  font-size: 0.72rem;
  color: var(--ash);
  font-family: 'IBM Plex Mono', monospace;
}

/* ---------- Barra comparativa (elemento distintivo) ---------- */
.gauge { margin-top: 34px; }

.gauge-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ash);
  margin: 0 0 10px;
}

.gauge-track {
  position: relative;
  height: 6px;
  margin: 0 2px;
  background:
    repeating-linear-gradient(to right, rgba(245,244,241,0.18) 0 1px, transparent 1px calc(100% / 12)),
    linear-gradient(to right, var(--black) 0% 82%, rgba(225, 6, 0, 0.4) 100%);
  border: 1px solid var(--hairline);
}

.gauge-tick {
  position: absolute;
  top: -6px;
  width: 2px;
  height: 18px;
  transform: translateX(-1px);
}
.gauge-tick--medio { background: var(--ash); }
.gauge-tick--ponderado { background: var(--paper); }
.gauge-tick--compra {
  background: var(--red-bright);
  width: 3px;
  height: 22px;
  top: -8px;
}

.gauge-scale {
  display: flex;
  justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--ash);
  margin-top: 8px;
}

.gauge-legend {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--paper);
}
.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: middle;
}
.legend-dot--medio { background: var(--ash); }
.legend-dot--ponderado { background: var(--paper); }
.legend-dot--compra { background: var(--red-bright); }

/* ---------- Tabla de comparables ---------- */
.table-wrap { margin-top: 34px; overflow-x: auto; }

table.comparables {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.comparables th {
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ash);
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
table.comparables td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
table.comparables td.num, table.comparables th.num {
  font-family: 'IBM Plex Mono', monospace;
  text-align: right;
}
table.comparables tr:hover td { background: rgba(245, 244, 241, 0.03); }

.badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border: 1px solid;
  white-space: nowrap;
  display: inline-block;
}
.badge-particular { color: var(--ash); border-color: var(--hairline); }
.badge-concesionario { color: var(--red-bright); border-color: var(--red); }

.link-ver {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Estado vacío ---------- */
.empty-state {
  margin-top: 26px;
  padding: 22px;
  border: 1px dashed var(--hairline);
  color: var(--ash);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.86rem;
}

footer.note {
  margin-top: 44px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--ash);
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  body { padding: 0 18px 60px; }
  .field-grid, .field-grid--four { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .pct-chip { width: 100%; }
}
