/* ── F1 Page Styles ──
   Shares the same green design tokens (--color-accent: #22e07a, etc.)
   as the horse racing and snooker pages via base.css.
   F1-specific accent colour (#e10600) is used only for F1-unique
   elements like driver number badges, tab indicators, and round badges. */

/* ── Page Layout ── */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 64px;
}

/* ── Header ── */
.f1-header-section { text-align: center; padding: 2rem 0 1rem; }
.f1-page-title { font-size: 2.4rem; font-weight: 800; margin-bottom: 0.5rem; color: var(--color-foreground); }
.f1-page-subtitle { color: var(--color-muted); font-size: 1.1rem; }

/* ── Race List Grid ── */
.f1-races-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; margin-top: 1rem; }
.f1-race-card { display: block; background: var(--color-brown-surface); border: 1px solid var(--color-brown-border); border-radius: 12px; padding: 1.25rem; text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s; }
.f1-race-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.f1-race-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.f1-race-flag { border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.f1-race-round { font-size: 0.8rem; color: var(--color-foreground); font-weight: 700; background: var(--color-accent-subtle); padding: 2px 10px; border-radius: 12px; }
.f1-race-name { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.25rem; color: var(--color-foreground); }
.f1-race-circuit { color: var(--color-muted); font-size: 0.9rem; }
.f1-race-date { color: var(--color-muted); font-size: 0.85rem; margin-top: 0.25rem; }
.f1-sprint-badge { display: inline-block; background: linear-gradient(135deg, #e10600, #ff3344); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-top: 0.5rem; }
.f1-race-card-stats { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.f1-stat-chip { font-size: 0.75rem; background: var(--color-surface-2); padding: 3px 8px; border-radius: 8px; color: var(--color-muted); }

/* ── GP Detail Info Card ── */
.gp-info-card { background: var(--color-brown-surface); border: 1px solid var(--color-brown-border); border-radius: 16px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 30px 80px rgba(0,0,0,0.45), 0 0 0 1px rgba(34,224,122,0.04); position: relative; }
.gp-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; position: relative; }
.gp-header-left { display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 0; }
.gp-flag { border-radius: 6px; flex-shrink: 0; }
.gp-title { font-size: 1.6rem; font-weight: 800; margin: 0; color: var(--color-foreground); }
.gp-subtitle { color: var(--color-muted); margin: 0.25rem 0 0; font-size: 0.9rem; }
.gp-date { font-size: 0.9rem; color: var(--color-muted); margin: 0.2rem 0 0; }
.gp-header .copy-link-btn { position: absolute; top: 0; right: 0; }

/* ── GP Body (container inside the info card) ── */
.gp-body { margin-top: 1.5rem; border-top: 1px solid var(--color-brown-border); padding-top: 1.25rem; }

/* ── Side-by-Side Panels (Circuit Info + Schedule) ── */
.gp-info-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }

@media (max-width: 700px) {
    .gp-info-panels { grid-template-columns: 1fr; }
}

/* ── Table-Style Info Rows ── */
.gp-info-table-section { margin-bottom: 0; }
.gp-info-table-section .section-heading { margin-bottom: 0.75rem; }

.gp-info-table { width: 100%; border-collapse: collapse; }
.gp-info-table th, .gp-info-table td { padding: 0.25rem 0.5rem; text-align: left; }
.gp-info-table th { width: 40%; font-size: 0.8rem; color: var(--color-muted-2); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; white-space: nowrap; }
.gp-info-table td { font-weight: 600; font-size: 0.9rem; color: var(--color-foreground); }
.schedule-time { font-size: 0.85rem; font-weight: 600; color: var(--color-foreground); }
.schedule-tbd { color: var(--color-muted-2); font-style: italic; }
.circuit-type-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.circuit-type-street { background: rgba(245,158,11,0.15); color: #f59e0b; }
.circuit-type-permanent { background: var(--color-accent-subtle); color: var(--color-accent); }
.circuit-type-hybrid { background: rgba(100,150,255,0.15); color: #6496ff; }
.inline-flag { vertical-align: middle; margin-right: 4px; border-radius: 2px; }

/* ── Circuit Metrics ── */
.circuit-metrics-section { margin-bottom: 0; }
.circuit-metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.metric-card { background: var(--color-brown-surface); border: 1px solid var(--color-brown-border); border-radius: 12px; padding: 1.25rem; text-align: center; }
.metric-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--color-foreground); position: relative; }
.metric-value { display: block; font-size: 1.6rem; font-weight: 800; color: var(--color-accent); }
.metric-desc { display: block; font-size: 0.7rem; color: var(--color-muted); margin-top: 0.3rem; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--color-border); margin-bottom: 1.5rem; }
.tab-btn { background: none; border: none; color: var(--color-muted); font-size: 1rem; font-weight: 600; padding: 0.75rem 1.5rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; font-family: inherit; }
.tab-btn:hover { color: var(--color-foreground); }
.tab-btn.active { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Driver Grid (2 columns on desktop) ── */
.driver-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 700px) {
    .driver-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Driver Card ── */
.driver-card { background: var(--color-brown-surface); border: 1px solid var(--color-brown-border); border-radius: 12px; margin-bottom: 1.25rem; overflow: hidden; }
.driver-card-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; background: var(--color-brown-subtle); }
.driver-identity { display: flex; align-items: center; gap: 1rem; }
.driver-number-badge { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 1.1rem; flex-shrink: 0; }
.driver-name { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--color-foreground); }
.driver-code { font-size: 0.8rem; color: #e10600; font-weight: 800; margin-left: 6px; background: rgba(225,6,0,0.1); padding: 1px 6px; border-radius: 4px; }
.driver-team { margin: 0.15rem 0 0; font-size: 0.85rem; color: var(--color-muted); }
.driver-flag-img { vertical-align: middle; margin-right: 4px; border-radius: 2px; }
.card-section { padding: 1rem 1.25rem; border-top: 1px solid var(--color-border); }
.card-section h4 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 0.5rem; color: var(--color-muted-2); position: relative; }
.stat-table { width: 100%; border-collapse: collapse; }
.stat-table td { padding: 0.35rem 0; font-size: 0.85rem; }
.stat-table td:first-child { color: var(--color-muted); }
.stat-table td:last-child { text-align: right; font-weight: 600; color: var(--color-foreground); }
.form-results { display: flex; gap: 6px; flex-wrap: wrap; }
.form-badge { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; font-size: 0.75rem; font-weight: 700; background: var(--color-surface-2); color: var(--color-foreground); }
.form-pos { background: var(--color-accent-subtle); color: var(--color-accent); }

/* ── Comparison Matrix ── */
.comparison-tooltip-info { background: var(--color-brown-surface); border: 1px solid var(--color-brown-border); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; font-size: 0.85rem; color: var(--color-muted); }
.comparison-matrix-wrapper { overflow: scroll; margin-bottom: 1.5rem; }
.comparison-matrix { width: 100%; border-collapse: collapse; }
.comparison-matrix th, .comparison-matrix td { padding: 0.6rem 0.8rem; text-align: center; font-size: 0.8rem; white-space: nowrap; }
.matrix-corner { background: transparent; }
.matrix-row-header, .matrix-col-header { font-weight: 700; color: var(--color-foreground); background: var(--color-brown-subtle); }
.matrix-cell { cursor: pointer; border-radius: 4px; transition: transform 0.1s; font-weight: 600; min-width: 40px; }
.matrix-cell:hover { transform: scale(1.1); }
.matrix-self { background: var(--color-brown-subtle); color: var(--color-muted-2); cursor: default; }
.matrix-selected { outline: 2px solid var(--color-accent); outline-offset: -2px; }

.adv-strong { background: rgba(0,200,83,0.35); color: #00c853; }
.adv-moderate { background: rgba(0,200,83,0.2); color: #69f0ae; }
.adv-slight { background: rgba(0,200,83,0.1); color: #b9f6ca; }
.adv-even { background: var(--color-brown-subtle); color: var(--color-muted); }
.adv-losing-strong { background: rgba(225,6,0,0.35); color: #ff5252; }
.adv-losing-moderate { background: rgba(225,6,0,0.2); color: #ff8a80; }
.adv-losing-slight { background: rgba(225,6,0,0.1); color: #ffcdd2; }

.comparison-detail { background: var(--color-brown-surface); border: 1px solid var(--color-brown-border); border-radius: 12px; padding: 1.25rem; margin: 1.5rem 0; }
.comparison-detail-title { margin: 0 0 1rem; font-size: 1.1rem; color: var(--color-foreground); }
.comparison-detail-table-wrapper { overflow-x: auto; }
.comparison-detail-table { width: 100%; border-collapse: collapse; }
.comparison-detail-table th, .comparison-detail-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border); font-size: 0.85rem; }
.comparison-detail-table th { text-align: left; color: var(--color-muted); font-weight: 600; }
.detail-stat-label { color: var(--color-muted); }
.detail-better { color: #00c853; font-weight: 700; }
.detail-worse { color: #ff5252; font-weight: 700; }

.comparison-legend { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem; padding: 0.75rem 0; }
.legend-label { font-weight: 700; color: var(--color-muted); margin-right: 0.5rem; }
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }

@media (max-width: 600px) {
  .f1-races-grid { grid-template-columns: 1fr; }
  .gp-header { flex-direction: column; align-items: flex-start; }
  .gp-title { font-size: 1.2rem; }
  .gp-header .copy-link-btn { position: static; align-self: flex-end; font-size: 0.78rem; padding: 4px 10px; }
  .copy-link-btn { font-size: 0.78rem; padding: 4px 10px; }
  .circuit-metrics-grid { grid-template-columns: 1fr 1fr; }
  .tabs { overflow-x: auto; }
}