/* ============================================================
   F1 TELEMETRY — Design System v2
   "Race Engineering Instrument" — premium dark, technical,
   telemetry-readout aesthetic.
   Type: Saira (display) · Hanken Grotesk (body) · JetBrains Mono (data)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Saira:wght@400;500;600;700;800;900&family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ---------------------------------------------------------- */
/* Tokens                                                     */
/* ---------------------------------------------------------- */
:root {
    /* Brand */
    --f1-red: #e10600;
    --f1-red-hover: #ff2d24;
    --f1-red-deep: #b30500;
    --f1-red-glow: rgba(225, 6, 0, 0.30);
    --f1-red-subtle: rgba(225, 6, 0, 0.09);
    --accent: #2de2e6;          /* telemetry cyan — used sparingly */
    --accent-subtle: rgba(45, 226, 230, 0.10);

    /* Surfaces (cool carbon) */
    --bg-body: #08080b;
    --bg-sidebar: #0c0c11;
    --bg-card: #121219;
    --bg-card-hover: #16161f;
    --bg-input: #16161f;
    --bg-input-focus: #1c1c27;
    --bg-elevated: #1d1d28;

    /* Borders */
    --border-default: rgba(255, 255, 255, 0.07);
    --border-subtle: rgba(255, 255, 255, 0.045);
    --border-hover: rgba(255, 255, 255, 0.16);
    --border-active: var(--f1-red);

    /* Text */
    --text-primary: #f4f4f6;
    --text-secondary: #b1b1bd;
    --text-muted: #74747f;
    --text-disabled: #4d4d57;

    /* Type */
    --font-display: 'Saira', system-ui, sans-serif;
    --font-body: 'Hanken Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    /* Radius */
    --radius-sm: 7px;
    --radius-md: 11px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 0 1px rgba(225, 6, 0, 0.5), 0 8px 28px var(--f1-red-glow);

    /* Motion */
    --transition-fast: 140ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 360ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Chart */
    --chart-bg: #121219;
    --chart-grid: rgba(255, 255, 255, 0.06);
    --chart-text: #d1d1d6;
}

/* ---------------------------------------------------------- */
/* Reset & Base                                               */
/* ---------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    line-height: 1.6;
    letter-spacing: 0.1px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    min-height: 100vh;
}

/* Ambient atmosphere: fine engineering grid + top red bloom.
   Pure CSS — no image dependency. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 480px at 78% -8%, rgba(225, 6, 0, 0.12), transparent 60%),
        radial-gradient(700px 500px at 0% 100%, rgba(45, 226, 230, 0.05), transparent 55%),
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 100% 44px,
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 44px 100%;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%);
            mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%);
}

/* keep content above the atmosphere layer */
.container,
.container-fluid,
.sidebar,
.main-content,
.topbar,
main,
nav,
footer,
section {
    position: relative;
    z-index: 1;
}

h1, h2, h3, h4, h5, h6,
.dashboard-title, .profile-title, .select-event-title, .card-title {
    font-family: var(--font-display);
}

a {
    color: var(--f1-red);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--f1-red-hover);
}

::selection {
    background: var(--f1-red);
    color: #fff;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.10);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* Shared kicker / technical eyebrow label */
.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.eyebrow::before {
    content: '';
    width: 18px;
    height: 2px;
    background: var(--f1-red);
    display: inline-block;
}

/* ============================================================
   SHELL: SIDEBAR + TOPBAR
   ============================================================ */
.app-shell {
    min-height: 100vh;
}

.sidebar {
    background-color: var(--bg-sidebar);
    width: 252px;
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 40;
    overflow-y: auto;
}

/* Bootstrap-column based pages still work: the old grid markup uses
   .col-* + .sidebar; force full height + flex there too. */
.sidebar.collapse:not(.show) {
    display: flex;
}

.sidebar-logo {
    padding: 22px 20px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-default);
    text-align: center;
}

.sidebar-logo img {
    height: 74px;
    width: auto;
    display: inline-block;
    filter: brightness(1.08);
}

.sidebar .nav {
    padding: 10px 12px;
    gap: 2px;
}

.sidebar .nav-section {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-disabled);
    padding: 16px 12px 8px;
}

.sidebar .nav-link {
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-body);
    transition: all var(--transition-base);
    border-left: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, var(--f1-red-subtle), transparent);
    color: var(--text-primary);
    border-left-color: var(--f1-red);
    font-weight: 600;
}

.sidebar .nav-link.active .icon-space {
    color: var(--f1-red);
}

.icon-space {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    font-size: 1.05rem;
    color: var(--text-muted);
    transition: color var(--transition-base);
}

.sidebar .nav-link:hover .icon-space {
    color: var(--text-primary);
}

/* User card */
.user-info {
    padding: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    margin: auto 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}

.user-info strong {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-subscription {
    background: linear-gradient(135deg, var(--f1-red), #ff3d00);
    color: #fff;
    padding: 2px 9px;
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    margin-left: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Mobile topbar (hidden on desktop) */
.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(12, 12, 17, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 45;
}

.topbar img {
    height: 34px;
}

.topbar-toggle {
    background: transparent;
    border: 1px solid var(--border-hover);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.topbar-toggle:hover {
    border-color: var(--f1-red);
    color: var(--f1-red);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 39;
}

.sidebar-backdrop.show {
    display: block;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    padding: 36px 40px;
    min-height: 100vh;
    margin-left: 252px;
    max-width: calc(100% - 252px);
    background: transparent;
}

/* Legacy compatibility: pages still using the Bootstrap grid shell
   (.container-fluid > .row > .sidebar.col + main.col-*) — keep the main
   column correctly placed beside the now-fixed sidebar. */
.container-fluid > .row > main[class*="col-"] {
    margin-left: 252px;
    max-width: calc(100% - 252px);
    flex: 0 0 auto;
}

/* Page header */
.page-head {
    margin-bottom: 28px;
}

.page-head .eyebrow {
    margin-bottom: 10px;
}

/* ============================================================
   CARDS
   ============================================================ */
.dashboard-card,
.profile-card,
.form-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 26px;
    margin-bottom: 24px;
    border: 1px solid var(--border-default);
    transition: all var(--transition-base);
}

.dashboard-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-icon {
    font-size: 1.75rem;
    margin-bottom: 12px;
    color: var(--text-muted);
    transition: color var(--transition-base);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control,
.form-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    margin-bottom: 0;
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: all var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-input-focus);
    color: var(--text-primary);
    border-color: var(--f1-red);
    box-shadow: 0 0 0 3px var(--f1-red-glow);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-disabled);
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    opacity: 1;
    cursor: not-allowed;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.form-select option {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8125rem;
    margin-bottom: 7px;
    letter-spacing: 0.3px;
}

.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border-hover);
}

.form-check-input:checked {
    background-color: var(--f1-red);
    border-color: var(--f1-red);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--f1-red-glow);
    border-color: var(--f1-red);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary,
.btn-f1 {
    background: linear-gradient(135deg, var(--f1-red), var(--f1-red-deep));
    border: none;
    color: #fff;
    font-weight: 600;
    font-family: var(--font-display);
    letter-spacing: 0.3px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.btn-primary:hover,
.btn-f1:hover {
    background: linear-gradient(135deg, var(--f1-red-hover), var(--f1-red));
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
    color: #fff;
}

.btn-outline-primary,
.btn-outline-f1 {
    color: var(--f1-red);
    border: 1.5px solid var(--f1-red);
    background: transparent;
    font-family: var(--font-display);
    font-weight: 600;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.btn-outline-primary:hover,
.btn-outline-f1:hover {
    background-color: var(--f1-red);
    border-color: var(--f1-red);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-f1-action {
    background: linear-gradient(135deg, var(--f1-red), var(--f1-red-deep));
    color: #fff;
    border: none;
    padding: 12px 28px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
    box-shadow: 0 6px 18px rgba(225, 6, 0, 0.28);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-f1-action:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(225, 6, 0, 0.5);
    background: linear-gradient(135deg, var(--f1-red-hover), var(--f1-red));
    color: #fff;
}

.btn-f1-action:disabled {
    background: var(--bg-elevated);
    cursor: not-allowed;
    box-shadow: none;
    color: var(--text-disabled);
}

.btn-f1-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-hover);
    padding: 10px 22px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-f1-secondary:hover:not(:disabled) {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-f1-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-lg {
    font-family: var(--font-display);
}

/* ============================================================
   TITLES
   ============================================================ */
.dashboard-title,
.profile-title,
.select-event-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    line-height: 1.1;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

/* ============================================================
   TABS
   ============================================================ */
.nav-tabs {
    border-bottom: 1px solid var(--border-default);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    margin-bottom: -1px;
    background-color: transparent;
    font-weight: 600;
    font-family: var(--font-display);
    font-size: 0.875rem;
    transition: all var(--transition-base);
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--f1-red);
    background-color: transparent;
    border-bottom-color: var(--f1-red);
    font-weight: 700;
}

.tab-content {
    padding-top: 20px;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: none;
    font-size: 0.875rem;
}

.alert-danger {
    background-color: rgba(225, 6, 0, 0.1);
    color: #ff8a85;
    border: 1px solid rgba(225, 6, 0, 0.25);
}

/* ============================================================
   DROPDOWNS
   ============================================================ */
.dropdown-menu {
    background-color: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--f1-red-subtle);
    color: var(--text-primary);
}

/* ============================================================
   RECENT ACTIVITIES
   ============================================================ */
.recent-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-default);
    transition: background-color var(--transition-fast);
}

.recent-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.recent-item:last-child {
    border-bottom: none;
}

/* ============================================================
   ANALYSIS WORKBENCH (select_analysis)
   ============================================================ */
.workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

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

.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-default);
    background: rgba(255, 255, 255, 0.015);
}

.panel-head h2,
.panel-head .panel-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-primary);
}

.panel-head h2 i,
.panel-head .panel-title i {
    color: var(--f1-red);
}

.panel-body {
    padding: 20px;
}

/* Sticky right rail (pilots / action) */
.rail-sticky {
    position: sticky;
    top: 20px;
}

/* Analysis result images (matplotlib PNG fragments) must fit the panel —
   they render at native figure resolution and would otherwise overflow/crop. */
#resultContainer img,
.panel-body img,
.form-card img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}

#resultContainer {
    overflow-x: auto;
}

/* Category label inside analysis list */
.analysis-section-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 22px 4px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-default);
}

.analysis-section-label:first-child {
    margin-top: 4px;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
    gap: 12px;
}

/* Analysis card — selectable tile */
.analysis-card-modern {
    background: linear-gradient(155deg, var(--bg-elevated), var(--bg-card));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.analysis-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background-color: transparent;
    transition: background-color var(--transition-base);
}

.analysis-card-modern::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -30%;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, var(--f1-red-glow), transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.analysis-card-modern:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.analysis-card-modern:hover::after {
    opacity: 0.6;
}

.analysis-card-modern.selected {
    background: linear-gradient(155deg, rgba(225, 6, 0, 0.14), var(--bg-card));
    border-color: var(--f1-red);
    box-shadow: var(--shadow-glow);
}

.analysis-card-modern.selected::before {
    background-color: var(--f1-red);
}

.analysis-card-modern.selected::after {
    opacity: 1;
}

.analysis-card-modern .card-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    transition: color var(--transition-base);
}

.analysis-card-modern:hover .card-icon,
.analysis-card-modern.selected .card-icon {
    color: var(--f1-red);
}

.analysis-card-modern .card-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-primary);
    line-height: 1.25;
}

.analysis-card-modern .card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Meta pills (year / circuit / session) */
.meta-pill {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: 100px;
    padding: 5px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.meta-pill i {
    color: var(--f1-red);
    font-size: 0.78rem;
}

/* ============================================================
   PILOT GRID
   ============================================================ */
.pilot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    gap: 10px;
    max-height: 460px;
    overflow-y: auto;
    padding: 4px;
}

.driver-card {
    background-color: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--transition-base);
    position: relative;
}

.driver-card:hover {
    background-color: var(--bg-elevated);
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.driver-card.selected {
    border-color: var(--f1-red);
    background-color: rgba(225, 6, 0, 0.1);
    box-shadow: 0 0 0 1px var(--f1-red), 0 6px 16px var(--f1-red-glow);
}

.driver-card img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-default);
    margin-bottom: 6px;
    transition: border-color var(--transition-base);
    background: var(--bg-elevated);
}

.driver-card.selected img {
    border-color: var(--f1-red);
}

.driver-card .driver-name {
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-card.selected .driver-name {
    color: var(--text-primary);
}

.driver-card.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.pilot-grid::-webkit-scrollbar {
    width: 6px;
}

.pilot-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* ============================================================
   CIRCUIT CARDS (select_event)
   ============================================================ */
.circuit-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 0;
    transition: all var(--transition-base);
    height: 100%;
}

.circuit-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--f1-red);
}

.circuit-header {
    background-size: cover;
    background-position: center;
    height: 150px;
    position: relative;
    background-color: var(--bg-elevated);
}

.circuit-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(8, 8, 11, 0.15), rgba(8, 8, 11, 0.92));
    display: flex;
    align-items: flex-end;
    padding: 16px;
}

.circuit-title {
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.2px;
}

.circuit-body {
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}

/* ============================================================
   PLAN CARDS (profile)
   ============================================================ */
.plan-card {
    background-color: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 26px;
    height: 100%;
    transition: all var(--transition-base);
    text-align: center;
}

.plan-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.plan-card.active {
    border-color: var(--f1-red);
    box-shadow: var(--shadow-glow);
}

.plan-price {
    font-size: 2rem;
    font-weight: 800;
    font-family: var(--font-display);
    margin: 16px 0;
    color: var(--text-primary);
}

.plan-period {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ============================================================
   DASHBOARD ACTION TILES
   ============================================================ */
.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.dashboard-action-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    background: linear-gradient(150deg, rgba(225, 6, 0, 0.16), var(--bg-card) 60%);
    color: #fff;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: 0.3px;
    padding: 22px;
    min-height: 150px;
    text-align: left;
    text-decoration: none;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.dashboard-action-btn::after {
    content: '\2192';
    position: absolute;
    top: 20px;
    right: 22px;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all var(--transition-base);
}

.dashboard-action-btn i {
    font-size: 1.9rem;
    margin-bottom: auto;
    color: var(--f1-red);
}

.dashboard-action-btn:hover,
.dashboard-action-btn:focus {
    transform: translateY(-4px);
    border-color: var(--f1-red);
    box-shadow: var(--shadow-md);
    color: #fff;
    text-decoration: none;
}

.dashboard-action-btn:hover::after {
    color: var(--f1-red);
    transform: translateX(4px);
}

.dashboard-action-btn.outline {
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.03), var(--bg-card) 60%);
}

.dashboard-action-btn.outline i {
    color: var(--text-secondary);
}

.dashboard-action-btn.outline:hover i {
    color: var(--f1-red);
}

/* small descriptor under tile label */
.dashboard-action-btn .tile-desc {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
    background: var(--bg-input);
    border-radius: 100px;
    height: 9px;
    overflow: hidden;
}

.progress-bar {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    background: linear-gradient(90deg, var(--f1-red), var(--f1-red-hover)) !important;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.03em;
}

.breadcrumb-item a {
    color: var(--text-muted);
}

.breadcrumb-item a:hover {
    color: var(--f1-red);
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-disabled);
}

/* ============================================================
   LIST GROUP (lap modal)
   ============================================================ */
.list-group-item.active {
    background-color: var(--f1-red) !important;
    border-color: var(--f1-red) !important;
    color: #fff !important;
}

.list-group-item:hover:not(.active) {
    background-color: var(--bg-input) !important;
}

/* ============================================================
   AUTH PAGES (login / register)
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
}

.auth-aside {
    position: relative;
    overflow: hidden;
    padding: 56px 52px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(700px 400px at 20% 0%, rgba(225, 6, 0, 0.25), transparent 60%),
        linear-gradient(160deg, #15060a, #08080b 70%);
    border-right: 1px solid var(--border-default);
}

.auth-aside::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 100% 40px,
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 40px 100%;
    -webkit-mask-image: radial-gradient(circle at 30% 30%, #000, transparent 75%);
            mask-image: radial-gradient(circle at 30% 30%, #000, transparent 75%);
    pointer-events: none;
}

.auth-aside-content {
    position: relative;
    z-index: 1;
}

.auth-aside h2 {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.5px;
    margin: 18px 0 14px;
}

.auth-aside p {
    color: var(--text-secondary);
    font-size: 1.02rem;
    max-width: 420px;
}

.auth-aside .auth-stat {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    position: relative;
    z-index: 1;
}

.auth-aside img.brand {
    height: 56px;
    width: auto;
    position: relative;
    z-index: 1;
}

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 8px;
    position: relative;
}

.auth-logo {
    text-align: center;
    margin-bottom: 26px;
}

.auth-logo img {
    height: 96px;
    width: auto;
    filter: brightness(1.08);
}

.auth-container h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.auth-container .auth-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 26px;
}

.auth-footer {
    text-align: center;
    margin-top: 22px;
}

.auth-footer a {
    color: var(--f1-red);
    font-weight: 600;
}

.auth-footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 8px;
}

@media (max-width: 860px) {
    .auth-page {
        grid-template-columns: 1fr;
    }
    .auth-aside {
        display: none;
    }
}

/* ============================================================
   LANDING PAGE
   ============================================================ */
.f1-navbar {
    background-color: rgba(8, 8, 11, 0.78) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-default);
    padding: 14px 0;
}

.f1-navbar .navbar-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.f1-navbar .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.f1-navbar .nav-link:hover {
    color: var(--text-primary);
}

.hero {
    position: relative;
    padding: 200px 0 150px;
    margin-bottom: 0;
    overflow: hidden;
    background:
        radial-gradient(1100px 600px at 75% -10%, rgba(225, 6, 0, 0.28), transparent 58%),
        radial-gradient(800px 500px at 5% 110%, rgba(45, 226, 230, 0.08), transparent 55%),
        linear-gradient(180deg, #0c0408 0%, var(--bg-body) 70%);
}

/* speed streaks behind hero */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(115deg, transparent 0 38px, rgba(255, 255, 255, 0.022) 38px 39px),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px) 0 0 / 100% 52px;
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
            mask-image: linear-gradient(180deg, #000, transparent 85%);
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 140px;
    background: linear-gradient(transparent, var(--bg-body));
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero .hero-kicker {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--f1-red);
    margin-bottom: 22px;
    display: inline-block;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 4.2rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -2px;
    line-height: 1.02;
    text-transform: uppercase;
}

.hero p {
    font-size: 1.2rem;
    max-width: 640px;
    margin: 22px auto 0;
    color: var(--text-secondary);
    font-weight: 400;
}

.feature-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 0;
    transition: all var(--transition-base);
    height: 100%;
    border: 1px solid var(--border-default);
    text-align: left;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--f1-red);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 1.65rem;
    margin-bottom: 20px;
    color: var(--f1-red);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--f1-red-subtle);
    border: 1px solid rgba(225, 6, 0, 0.25);
    border-radius: var(--radius-md);
}

.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.pricing-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 36px;
    position: relative;
    transition: all var(--transition-base);
    height: 100%;
    text-align: center;
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.pricing-card h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.3px;
}

.pricing-card.featured {
    border-color: var(--f1-red);
    box-shadow: var(--shadow-glow);
}

.popular-tag {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, var(--f1-red), var(--f1-red-deep));
    color: #fff;
    padding: 4px 13px;
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price {
    font-family: var(--font-display);
    font-size: 2.6rem;
    margin: 18px 0;
    color: #fff;
    font-weight: 800;
}

.period {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
    font-family: var(--font-body);
}

.section-heading {
    margin-bottom: 56px;
}

.section-heading h2 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.section-heading p {
    color: var(--text-secondary);
    max-width: 660px;
    margin: 0 auto;
    font-size: 1.05rem;
}

.f1-footer {
    background-color: var(--bg-sidebar);
    padding: 48px 0;
    color: var(--text-muted);
    border-top: 1px solid var(--border-default);
}

.f1-footer h5 {
    font-family: var(--font-display);
    font-weight: 700;
}

.footer-social a {
    color: var(--text-muted);
    margin-right: 16px;
    font-size: 1.25rem;
    transition: color var(--transition-base);
}

.footer-social a:hover {
    color: var(--f1-red);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-f1-red {
    color: var(--f1-red) !important;
}

.font-mono {
    font-family: var(--font-mono) !important;
}

.bg-f1-dark {
    background-color: var(--bg-body) !important;
}

.border-f1 {
    border-color: var(--border-default) !important;
}

.glass-card {
    background: rgba(18, 18, 25, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

/* Bootstrap secondary badge override (used as meta tags) */
.badge.bg-secondary {
    background-color: var(--bg-input) !important;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    font-family: var(--font-mono);
    font-weight: 500;
}

/* Page reveal animation */
@keyframes f1-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.reveal {
    animation: f1-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.reveal-1 { animation-delay: 0.05s; }
.reveal-2 { animation-delay: 0.12s; }
.reveal-3 { animation-delay: 0.19s; }
.reveal-4 { animation-delay: 0.26s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .topbar {
        display: flex;
    }
    .main-content,
    .container-fluid > .row > main[class*="col-"] {
        margin-left: 0;
        max-width: 100%;
        padding: 22px 18px;
    }
    .hero h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 767px) {
    .dashboard-title,
    .profile-title,
    .select-event-title {
        font-size: 1.6rem;
    }
    .hero {
        padding: 130px 0 90px;
    }
    .hero h1 {
        font-size: 2.2rem;
        letter-spacing: -1px;
    }
    .hero p {
        font-size: 1.05rem;
    }
    .section-heading h2 {
        font-size: 1.9rem;
    }
    .main-content {
        padding: 20px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
