/* ── Shared side card styles ────────────────────────────────────────────── */

.side-card {
  position: absolute;
  right: 56px;
  z-index: 600;
  width: 300px;
  max-height: 65vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-float);
  overflow: hidden;
  opacity: 0;
  transform: translateX(12px) scale(0.96);
  transition: opacity 0.25s cubic-bezier(0.4,0,0.2,1),
              transform 0.25s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}

.side-card.card-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: all;
}

.side-card-title {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding: 12px 14px 0;
  flex-shrink: 0;
}

.side-card-body {
  flex: 1;
  overflow-y: hidden;
  padding: 10px 14px 0;
  display: flex;
  flex-direction: column;
}

.side-card-body .tab-panel {
  flex: 1;
  max-height: calc(65vh - 130px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  scrollbar-gutter: stable;
  padding-bottom: 14px;
  padding-right: 4px;
}

.side-card-body .tab-panel::-webkit-scrollbar { width: 4px; }
.side-card-body .tab-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* Round label fixed above scroll */
.standings-round-label {
  font-size: 0.58rem;
  color: var(--text-secondary);
  font-style: italic;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  flex-shrink: 0;
}


.side-card-body .card-tabs {
  flex-shrink: 0;
  padding: 0 0 8px 0;
  margin-bottom: 0;
}

.side-card-body::-webkit-scrollbar { width: 4px; }
.side-card-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.card-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 14px 0;
  flex-shrink: 0;
}

.card-tab {
  background: var(--bg-pill);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.card-tab:hover:not(.active) {
  background: var(--bg-pill-hover);
  color: var(--text-primary);
}

.card-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* ── Standings table ────────────────────────────────────────────────────── */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  margin-top: 8px;
}

.standings-table th {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 4px 4px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.standings-table th.pts-col,
.standings-table td.pts-col {
  text-align: right;
  color: var(--accent);
  font-weight: 700;
}

.standings-table td {
  padding: 7px 4px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.standings-table tbody tr:last-child td {
  border-bottom: none;
}

.standings-table tbody tr:hover td {
  background: var(--bg-pill);
}

/* Position number */
.standings-pos {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
  width: 20px;
  text-align: center;
}

/* Driver row */
.standings-driver {
  display: flex;
  align-items: center;
  gap: 6px;
}

.standings-abbr {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  min-width: 32px;
}

.standings-name {
  font-size: 0.65rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

/* Team colour bar */
.standings-team-bar {
  width: 3px;
  height: 18px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Team logo */
.standings-logo {
  height: 24px;
  width: auto;
  max-width: 60px;
  object-fit: contain;
  display: block;
}

/* Team name */
.standings-team-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Round label */
.standings-round-label {
  font-size: 0.58rem;
  color: var(--text-secondary);
  font-style: italic;
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* ── Map side action buttons ─────────────────────────────────────────────── */
#map-side-actions {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-side-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(15,15,26,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ccccdd;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: background 0.2s, color 0.2s, transform 0.2s, border-color 0.2s;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.map-side-btn:hover {
  background: rgba(40,40,60,0.9);
  color: #ffffff;
  transform: scale(1.08);
}

.map-side-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  transform: scale(1.08);
}

body.light-theme .map-side-btn {
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.1);
  color: #333344;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

body.light-theme .map-side-btn:hover {
  background: rgba(235,235,245,0.95);
  color: #111122;
}

body.light-theme .map-side-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

@media (max-width: 768px) {
  #map-side-actions {
    right: 10px;
    top: 42%;
  }

  .map-side-btn {
    width: 30px;
    height: 30px;
    font-size: 0.74rem;
  }

  .side-card {
    width: 260px;
    right: 46px;
    max-height: 55vh;
  }
}


body.circuit-panel-open #card-standings,
body.circuit-panel-open #map-side-actions {
  display: none;
}