/* ── KUT-KARTING APP — Estilos específicos del proyecto ───────────────────
   Complemento al diseño base de styles.css / ui-kit.css
   NO modificar styles.css ni ui-kit.css para mantener compatibilidad
   con actualizaciones del design system.
─────────────────────────────────────────────────────────────────────────── */

/* ── Barra de estado del capturer ── */
.capturer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid;
}
.capturer-badge.running  { color: var(--green);  border-color: var(--green);  background: rgba(64,212,160,0.08); }
.capturer-badge.stopped  { color: var(--dim);    border-color: var(--brd);    background: transparent; }
.capturer-badge.error    { color: var(--acc3);   border-color: var(--acc3);   background: rgba(240,61,106,0.08); }
.capturer-badge.restarting { color: var(--gold); border-color: var(--gold);   background: rgba(240,192,64,0.08); }
.capturer-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.capturer-badge.running .dot { animation: pulse-dot 1.5s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Tabla de clasificación en vivo ── */
.live-table { width: 100%; border-collapse: collapse; }
.live-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 6px 10px;
  border-bottom: 1px solid var(--brd);
  text-align: right;
}
.live-table th.th-l { text-align: left; }
.live-table td {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(31,37,53,0.5);
  text-align: right;
  color: var(--text);
}
.live-table td.td-l { text-align: left; }
.live-table tr:hover td { background: rgba(255,255,255,0.02); }
.live-table tr.in-pit td { color: var(--dim); font-style: italic; }
.live-table tr.in-pit td.td-status { color: var(--acc3); font-style: normal; }

/* Posición destacada */
.pos-badge {
  display: inline-block;
  width: 26px; height: 26px;
  line-height: 26px;
  text-align: center;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 14px;
}
.pos-1 { background: var(--gold);   color: #000; }
.pos-2 { background: var(--silver); color: #000; }
.pos-3 { background: var(--bronze); color: #000; }
.pos-n { background: var(--s3);     color: var(--dim); }

/* Colores de vuelta */
.lap-green  { color: var(--green); }
.lap-purple { color: var(--purple); }  /* best overall */
.lap-yellow { color: var(--gold); }
.lap-red    { color: var(--acc3); }

/* ── Panel de monitorización ── */
.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.monitor-card {
  background: var(--s2);
  border: 1px solid var(--brd);
  border-radius: 6px;
  padding: 16px;
}
.monitor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.monitor-card-title {
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.monitor-hb {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dimmer);
}
.monitor-event-name {
  font-family: var(--font-base);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.monitor-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* ── Log de eventos del capturer ── */
.event-log {
  background: var(--s1);
  border: 1px solid var(--brd);
  border-radius: 4px;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
}
.event-log-row {
  display: flex;
  gap: 10px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(31,37,53,0.4);
}
.event-log-row:last-child { border-bottom: none; }
.event-log-ts   { color: var(--dimmer); flex-shrink: 0; }
.event-log-type { flex-shrink: 0; width: 120px; }
.event-log-type.started    { color: var(--green); }
.event-log-type.stopped    { color: var(--dim); }
.event-log-type.restarted  { color: var(--gold); }
.event-log-type.error      { color: var(--acc3); }
.event-log-type.heartbeat_timeout { color: var(--orange); }
.event-log-detail { color: var(--text); }

/* ── Wizard de evento endurance ── */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--brd);
}
.wizard-step {
  padding: 10px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dimmer);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: default;
}
.wizard-step.active {
  color: var(--acc);
  border-bottom-color: var(--acc);
}
.wizard-step.done {
  color: var(--green);
  border-bottom-color: transparent;
}

/* ── Tabla de pilotos mínimos (reglamento endurance) ── */
.reg-table { width: 100%; border-collapse: collapse; }
.reg-table th, .reg-table td {
  padding: 8px 12px;
  border: 1px solid var(--brd);
  font-family: var(--font-mono);
  font-size: 12px;
}
.reg-table th { background: var(--s3); color: var(--dim); text-align: center; }
.reg-table td { background: var(--s2); color: var(--text); text-align: center; }
.reg-table input { width: 80px; text-align: center; }

/* ── Rating badges ── */
.rating-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rating-bar {
  flex: 1;
  height: 4px;
  background: var(--s3);
  border-radius: 2px;
  overflow: hidden;
}
.rating-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--acc);
  transition: width 0.4s ease;
}
.rating-bar-fill.positive { background: var(--green); }
.rating-bar-fill.negative { background: var(--acc3); }
.rating-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  min-width: 50px;
  text-align: right;
}

/* ── Página sin sesión activa ── */
.no-session {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 16px;
  color: var(--dimmer);
}
.no-session-icon {
  font-family: var(--font-display);
  font-size: 64px;
  color: var(--brd2);
  letter-spacing: 0.1em;
}
.no-session-text {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ── HTMX loading indicator ── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator  { display: inline-block; }
