/* ================================================================
   pages/race-detail.css — Public Race Detail page styles
   Uses --next-* design tokens from next-base.css
   ================================================================ */

/* ------------------------------------------------------------------
   Event hero card
   ------------------------------------------------------------------ */
.next-event-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--next-border);
  border-radius: var(--next-radius-xl);
}

.next-event-hero__cover {
  position: relative;
  aspect-ratio: 3 / 1;
  min-height: 140px;
  max-height: 280px;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(19, 186, 255, 0.10), rgba(138, 69, 255, 0.08)),
    var(--next-bg-900);
}

.next-event-hero__cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.next-event-hero__cover-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      transparent 20%,
      rgba(3, 8, 20, 0.6) 70%,
      rgba(3, 8, 20, 0.95) 100%
    );
}

.next-event-hero__body {
  padding: var(--next-space-5);
}

.next-event-hero__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--next-space-3);
  margin-bottom: var(--next-space-4);
}

.next-event-hero__title {
  font-size: var(--next-font-2xl);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--next-text-primary);
  flex: 1 1 auto;
  min-width: 0;
}

.next-event-hero__meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--next-space-3);
  margin-bottom: var(--next-space-4);
}

.next-event-hero__meta-item {
  display: flex;
  align-items: center;
  gap: var(--next-space-2);
  font-size: var(--next-font-sm);
  color: var(--next-text-secondary);
}

.next-event-hero__meta-item svg {
  flex-shrink: 0;
  color: var(--next-text-muted);
}

.next-event-hero__org-logo {
  border-radius: 50%;
  object-fit: contain;
}

.next-event-hero__champ {
  display: inline-flex;
  align-items: center;
  gap: var(--next-space-2);
  font-size: var(--next-font-sm);
  color: var(--next-text-secondary);
  padding: var(--next-space-2) var(--next-space-4);
  background: rgba(255, 191, 36, 0.06);
  border: 1px solid rgba(255, 191, 36, 0.2);
  border-radius: var(--next-radius-pill);
}

.next-event-hero__champ .next-link {
  color: var(--next-gold);
  font-weight: 600;
  text-decoration: none;
}

.next-event-hero__champ .next-link:hover {
  text-decoration: underline;
}

@media (min-width: 640px) {
  .next-event-hero__meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .next-event-hero__meta-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ------------------------------------------------------------------
   Tab panels
   ------------------------------------------------------------------ */
.next-tab-panel {
  animation: next-tab-fade-in 200ms ease;
}

.next-tab-panel[hidden] {
  display: none;
}

@keyframes next-tab-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .next-tab-panel {
    animation: none;
  }
}

/* ------------------------------------------------------------------
   Rankings grid (Highlights tab)
   ------------------------------------------------------------------ */
.next-rankings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--next-space-4);
}

@media (min-width: 1024px) {
  .next-rankings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ------------------------------------------------------------------
   Ranking preview card
   ------------------------------------------------------------------ */
.next-ranking-preview {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.next-ranking-preview__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--next-space-3);
  padding: var(--next-space-4) var(--next-space-4) 0;
}

.next-ranking-preview__title {
  font-size: var(--next-font-lg);
  font-weight: 700;
  color: var(--next-text-primary);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.next-ranking-preview__subtitle {
  font-size: var(--next-font-xs);
  font-weight: 400;
  color: var(--next-text-muted);
  display: block;
}

.next-ranking-preview__count {
  flex-shrink: 0;
}

.next-ranking-preview__empty {
  padding: var(--next-space-8) var(--next-space-4);
  text-align: center;
  color: var(--next-text-muted);
  font-size: var(--next-font-sm);
}

.next-ranking-preview__table-wrap {
  overflow-x: auto;
  padding: var(--next-space-3) 0 0;
}

.next-ranking-preview__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--next-font-sm);
  font-variant-numeric: tabular-nums;
}

.next-ranking-preview__th {
  text-align: left;
  padding: var(--next-space-2) var(--next-space-3);
  font-size: var(--next-font-xs);
  font-weight: 600;
  color: var(--next-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--next-border-muted);
  white-space: nowrap;
}

.next-ranking-preview__th--pos {
  width: 44px;
  text-align: center;
}

.next-ranking-preview__th--pilot {
  min-width: 120px;
}

.next-ranking-preview__th--metric {
  text-align: right;
  min-width: 72px;
}

.next-ranking-preview__row {
  transition: background var(--next-transition-fast);
}

.next-ranking-preview__row:hover {
  background: rgba(19, 186, 255, 0.04);
}

/* Hide rows 4-5 on mobile (show only top 3) */
@media (max-width: 639px) {
  .next-ranking-preview__row--extra {
    display: none;
  }
}

.next-ranking-preview__td {
  padding: var(--next-space-2) var(--next-space-3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.next-ranking-preview__td--pos {
  text-align: center;
}

.next-ranking-preview__td--metric {
  text-align: right;
}

.next-ranking-preview__pilot-name {
  color: var(--next-text-primary);
  font-weight: 600;
}

.next-ranking-preview__pilot-flag {
  margin-left: var(--next-space-2);
  font-size: var(--next-font-xs);
  color: var(--next-text-muted);
  font-weight: 500;
}

/* Position badges */
.next-ranking-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: var(--next-font-xs);
  font-weight: 700;
  color: var(--next-text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.next-ranking-pos--gold {
  background: rgba(255, 191, 36, 0.18);
  color: var(--next-gold);
  box-shadow: 0 0 10px rgba(255, 191, 36, 0.2);
}

.next-ranking-pos--silver {
  background: rgba(220, 220, 230, 0.14);
  color: #d0d0e0;
  box-shadow: 0 0 8px rgba(200, 200, 220, 0.12);
}

.next-ranking-pos--bronze {
  background: rgba(255, 138, 61, 0.16);
  color: var(--next-orange);
  box-shadow: 0 0 8px rgba(255, 138, 61, 0.14);
}

/* Metric values */
.next-metric-value {
  color: var(--next-cyan);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Footer */
.next-ranking-preview__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--next-space-3);
  padding: var(--next-space-3) var(--next-space-4) var(--next-space-4);
  border-top: 1px solid var(--next-border-muted);
  margin-top: auto;
}

.next-ranking-preview__showing {
  font-size: var(--next-font-xs);
  color: var(--next-text-secondary);
}

.next-ranking-preview__showing--mobile {
  display: none;
}

@media (max-width: 639px) {
  .next-ranking-preview__showing--desktop {
    display: none;
  }
  .next-ranking-preview__showing--mobile {
    display: inline;
  }
}

.next-ranking-trigger--mobile {
  display: none;
}

@media (max-width: 639px) {
  .next-ranking-trigger--desktop {
    display: none;
  }
  .next-ranking-trigger--mobile {
    display: inline;
  }
}

/* ------------------------------------------------------------------
   Pilots grid
   ------------------------------------------------------------------ */
.next-pilots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--next-space-4);
}

@media (min-width: 640px) {
  .next-pilots-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .next-pilots-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ------------------------------------------------------------------
   Pilot card
   ------------------------------------------------------------------ */
.next-pilot-card {
  display: flex;
  align-items: center;
  gap: var(--next-space-3);
  padding: var(--next-space-3) var(--next-space-4);
  transition:
    border-color var(--next-transition-normal),
    box-shadow var(--next-transition-normal);
}

.next-pilot-card:hover {
  border-color: var(--next-border-strong);
  box-shadow: var(--next-glow-blue);
}

.next-pilot-card__avatar-wrap {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--next-bg-800);
  border: 1.5px solid var(--next-border);
}

.next-pilot-card__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.next-pilot-card__avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--next-font-sm);
  font-weight: 800;
  color: var(--next-blue);
  background: rgba(19, 186, 255, 0.08);
}

.next-pilot-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.next-pilot-card__nickname {
  font-size: var(--next-font-sm);
  font-weight: 700;
  color: var(--next-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-pilot-card__name {
  font-size: var(--next-font-xs);
  color: var(--next-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-pilot-card__country {
  font-size: var(--next-font-xs);
  color: var(--next-text-muted);
}
