/* Slipstream — components in the F1 visual language: bold uppercase, sharp edges,
   angular red accents, broadcast tabular numbers. */

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg-elev-2); color: var(--text);
  font-size: 13px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  cursor: pointer; transition: transform 0.1s ease, background 0.15s, border-color 0.15s, filter 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:active { filter: brightness(1.1); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:active { background: var(--bg-elev); }
.btn-danger { background: transparent; border-color: rgba(255, 59, 70, 0.45); color: var(--danger); }
.btn-block { width: 100%; }

.icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text-mute);
  font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s, color 0.15s, border-color 0.15s;
}
.icon-btn:active { transform: scale(0.9); }
.icon-btn.danger:active { color: var(--danger); border-color: var(--danger); }

/* ---- Section header (angular red marker, uppercase Black) ---- */
.section-head { position: relative; margin: 2px 0 18px; padding-left: 15px; }
.section-head::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 5px; width: 6px;
  background: var(--accent); clip-path: polygon(34% 0, 100% 0, 66% 100%, 0 100%);
}
.section-head h1 {
  margin: 0; font-size: 27px; font-weight: 900; line-height: 0.98;
  letter-spacing: 0.005em; text-transform: uppercase;
}
.section-head p {
  margin: 6px 0 0; color: var(--text-dim); font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* ---- Tiles / cards ---- */
.card-grid { display: flex; flex-direction: column; gap: 10px; }
.tile {
  display: flex; align-items: stretch; gap: 12px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 12px 12px 0; overflow: hidden;
  transition: transform 0.12s ease, border-color 0.15s, background 0.15s;
}
.tile:active { transform: scale(0.99); border-color: var(--line); }
.tile .tile-main { flex: 1; min-width: 0; padding: 3px 0; }
.tile-title { font-weight: 800; font-size: 15.5px; letter-spacing: 0.02em; text-transform: uppercase; }
.tile-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; font-weight: 600; letter-spacing: 0.02em; }
/* Team/livery colour bar (F1 driver-card style) */
.swatch { width: 6px; align-self: stretch; flex: 0 0 auto; }

/* Overall rating badge — broadcast number block */
.ovr {
  flex: 0 0 auto; width: 50px; height: 50px; margin-left: 12px; align-self: center;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 20px; color: var(--text);
  font-variant-numeric: tabular-nums;
  background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  position: relative;
}
.ovr::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent);
}

/* ---- Portraits ---- */
.portrait { object-fit: cover; background: var(--bg-elev-2); display: block; }
.portrait-fallback {
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--text-mute); background: var(--bg-elev-2); letter-spacing: 0.02em;
}
.portrait-sm { width: 52px; height: 52px; border-radius: var(--radius-sm); flex: 0 0 auto; }

/* Racer tile leads with a headshot */
.racer-tile { padding: 10px; align-items: center; gap: 11px; }
.racer-tile .tile-main { padding: 0; }
.racer-tile .ovr { margin-left: 0; }

/* ---- Flags ---- */
.flag { display: inline-block; vertical-align: middle; }
.flag-icon { height: 14px; width: auto; vertical-align: -2px; }
.flag-full { height: 15px; width: auto; vertical-align: -3px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }

/* Trait chips — angular */
.trait-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.trait {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 9px; color: #fff; background: var(--accent-tint);
  border: 1px solid rgba(225, 6, 0, 0.4); border-radius: 2px;
}

/* Empty state */
.empty {
  text-align: center; color: var(--text-mute); font-size: 13px; line-height: 1.6;
  padding: 38px 22px; border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--bg-elev); letter-spacing: 0.01em;
}

/* Footer action row */
.view-foot { margin-top: 18px; display: flex; gap: 10px; }
.view-foot .btn { flex: 1; padding: 14px 18px; }

/* ---- Fields ---- */
.field { margin-bottom: 14px; }
.field-label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 7px;
}
.field-input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line); color: var(--text); font-size: 15px;
  font-family: inherit;
}
.field-input:focus { outline: none; border-color: var(--accent); }

/* ---- Toasts ---- */
.toast-host {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-bot) + 14px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 600; pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: 90vw;
  padding: 11px 18px 11px 16px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--line);
  border-left: 4px solid var(--text-mute); box-shadow: var(--shadow-2);
  opacity: 0; transform: translateY(12px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-in { opacity: 1; transform: translateY(0) scale(1); }
.toast.is-out { opacity: 0; transform: translateY(8px) scale(0.97); }
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--accent); }

/* ---- Modal (bottom sheet) ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 700;
  background: rgba(4, 5, 8, 0.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.18s ease;
}
.modal-overlay.is-in { opacity: 1; }
.modal-card {
  width: 100%; max-width: 480px;
  background: var(--bg-elev); border: 1px solid var(--line); border-bottom: 0;
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 18px calc(18px + var(--safe-bot));
  transform: translateY(16px); transition: transform 0.2s cubic-bezier(0.22, 0.91, 0.36, 1);
  box-shadow: var(--shadow-2);
}
.modal-overlay.is-in .modal-card { transform: translateY(0); }
@media (min-width: 560px) {
  .modal-overlay { align-items: center; }
  .modal-card { border-bottom: 1px solid var(--line); border-radius: var(--radius); }
}
.modal-title { font-size: 18px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 12px; }
.modal-body { font-size: 14px; color: var(--text); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
