/* ========================================
   PitWallPro Master Stylesheet
   Consolidated CSS for all pages
   ======================================== */

/* ========================================
   DESIGN TOKENS
   ======================================== */

:root {
    /* Brand — a single accent used everywhere instead of the old mix of
       purple (var(--brand)) on some pages and Bootstrap blue (var(--brand)) on others */
    --brand: #5b6ff0;
    --brand-dark: #4a3f9e;
    --brand-gradient: linear-gradient(135deg, #5b6ff0 0%, #7c4fd0 100%);

    --good: #3ecf7e;
    --warn: #ffa53d;
    --danger: #ff5c6c;

    /* Dark surface scale (dashboard / race-prep) */
    --surface-0: #16161d;
    --surface-1: #1e1e27;
    --surface-2: #262631;
    --surface-3: #30303d;
    --border-dark: #3a3a48;
    --text-dark-primary: #f3f3f7;
    --text-dark-muted: #9a9aab;

    /* Light surface scale (Bootstrap pages) */
    --surface-light: #f6f7fb;
    --border-light: #e3e5ee;
    --text-light-primary: #1f2129;
    --text-light-muted: #6b6f80;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-md: 0 8px 24px rgba(20, 20, 35, 0.10);
    --shadow-lg: 0 20px 50px rgba(20, 20, 35, 0.16);
}

/* ========================================
   GLOBAL RESET & BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-light-primary);
}

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.01em;
}

/* ========================================
   RACE PREP & RACE DASHBOARD (Dark Theme)
   ======================================== */

/* Race Dashboard Dark Theme */
.dashboard-body {
    background: var(--surface-0);
    color: #fff;
    padding: 20px;
    min-height: 100vh;
}

body:has(.dashboard-body) {
    background: var(--surface-0);
    color: #fff;
}

/* Race Prep Light Theme */
.race-prep-body {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    min-height: 100vh;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body:has(.race-prep-body) {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}

/* Bootstrap-based pages */
body {
    background-color: #f8f9fa;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.container-lg {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   HEADERS
   ======================================== */

header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 32px;
}

header p {
    color: #666;
    font-size: 14px;
}

/* Dashboard Header (Dark Theme) */
.dashboard-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.header-card {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.header-card h2 {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.header-value {
    font-size: 28px;
    font-weight: 700;
    color: white;
}

.header-subtext {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
}

/* ========================================
   MESSAGES & ALERTS
   ======================================== */

.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========================================
   STEP INDICATOR
   ======================================== */

.step-indicator {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    justify-content: center;
}

.step {
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    background: #f0f0f0;
    color: #999;
}

.step.active {
    background: var(--brand);
    color: white;
}

/* ========================================
   TRACK SELECTOR
   ======================================== */

.track-selector {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.track-selector-group {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.track-selector-group label {
    flex: 1;
}

.track-selector-group label span {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 600;
}

.track-selector-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.track-selector-group button {
    padding: 12px 24px;
    background: var(--brand);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.track-selector-group button:hover {
    background: var(--brand-dark);
}

/* ========================================
   DRIVERS GRID
   ======================================== */

.drivers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.driver-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.driver-header {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: white;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
}

.driver-content {
    padding: 20px;
}

.section {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.section h4 {
    font-size: 13px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

/* ========================================
   STRATEGIES GRID
   ======================================== */

.strategies-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.strategy-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 20px;
}

.strategy-panel h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 16px;
}

.strategies-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.strategy-item {
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.strategy-item:hover {
    border-color: var(--brand);
    background: #f9f9f9;
}

.strategy-item input[type="radio"] {
    cursor: pointer;
    margin-right: 8px;
}

.strategy-name {
    font-weight: 600;
    color: #333;
    display: inline;
}

.strategy-time {
    display: block;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.fastest-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #4caf50;
    color: white;
    font-size: 10px;
    border-radius: 3px;
    margin-left: 8px;
}

.grid-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--surface-light);
    border: 1px solid var(--border-light);
    color: var(--text-light-muted);
    font-size: 11px;
    font-weight: 700;
    border-radius: 3px;
    margin-left: 8px;
}

.plan-recommendation {
    background: #f0f4ff;
    border-left: 4px solid var(--brand);
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 12.5px;
    color: #444;
    margin-bottom: 12px;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    margin-left: 4px;
    vertical-align: middle;
}

.plan-badge-a { background: var(--good); }
.plan-badge-b { background: var(--brand); }
.plan-badge-c { background: var(--warn); }

.plan-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 12.5px;
    color: #fff;
}

.plan-legend .plan-badge {
    margin-left: 0;
    margin-right: 6px;
}

/* ========================================
   BUTTONS
   ======================================== */

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* ========================================
   RACE DASHBOARD - SPECIFIC STYLES
   ======================================== */

.dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.panel {
    background: var(--surface-2);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 20px;
    color: #fff;
}

.panel h3 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 18px;
}

.strategy-headline {
    background: var(--surface-2);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.strategy-headline h4 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 16px;
}

.strategy-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-item {
    background: var(--surface-3);
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid var(--brand);
}

.detail-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--brand);
}

.stint-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.stint-box {
    background: var(--surface-2);
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    border: 2px solid var(--border-dark);
    transition: all 0.3s;
}

.stint-box.active {
    background: var(--brand);
    border-color: var(--brand);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
}

.stint-compound {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stint-box.active .stint-compound {
    color: #fff;
}

.stint-laps {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.pit-window {
    background: var(--surface-2);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 8px;
    border-left: 3px solid #ffa500;
}

.pit-label {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.pit-range {
    font-size: 14px;
    font-weight: 600;
    color: #ffa500;
}

.lap-tracker {
    background: var(--surface-2);
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

.lap-tracker label {
    display: block;
    margin-bottom: 10px;
}

.lap-tracker label span {
    display: block;
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
}

.lap-tracker input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-dark);
    background: var(--surface-3);
    color: #fff;
    border-radius: 4px;
    margin-bottom: 10px;
}

.lap-tracker button {
    width: 100%;
    padding: 10px;
    background: var(--brand);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.lap-tracker button:hover {
    background: var(--brand-dark);
}

.progress-bar {
    background: var(--surface-2);
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    background: linear-gradient(90deg, var(--brand), var(--brand-dark));
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    transition: width 0.3s;
}

/* ========================================
   TUNING EDITOR
   ======================================== */

.profile-selector {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.profile-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    color: #333;
}

.profile-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.profile-btn.active {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
}

.category {
    margin-bottom: 40px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.category-header {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: white;
    padding: 15px 20px;
    font-weight: 600;
    font-size: 16px;
}

.category-body {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.param-field {
    display: flex;
    flex-direction: column;
}

.param-label {
    font-weight: 600;
    color: #333;
    font-size: 13px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.param-key {
    font-size: 12px;
    color: #999;
    font-family: 'Monaco', monospace;
    margin-bottom: 6px;
}

.param-input {
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.param-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.param-description {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
    line-height: 1.4;
}

.param-value-display {
    background: #f9f9f9;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: 'Monaco', monospace;
    font-size: 13px;
    color: var(--brand);
    margin-bottom: 4px;
    font-weight: 600;
}

.info-box {
    background: #f0f4ff;
    border-left: 4px solid var(--brand);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #555;
}

.info-box strong {
    display: block;
    margin-bottom: 8px;
}

/* ========================================
   DRIVER & TRACK FORM VIEWS (Bootstrap-based)
   ======================================== */

.form-card {
    max-width: 900px;
    margin: 0 auto;
}

.stat-input {
    max-width: 100px;
}

.stat-group {
    border: 1px solid #dee2e6;
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    background: white;
}

.stat-group h6 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand);
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-row label {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.range-display {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--brand);
    margin-top: 0.25rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h5 {
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 1.5rem;
}

/* ========================================
   DRIVERS TABLE
   ======================================== */

.drivers-table tbody tr:hover {
    background-color: #f1f3f5;
}

.stat-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    text-align: center;
}

.stat-cell.high {
    background-color: #d4edda;
    color: #155724;
    font-weight: bold;
}

.stat-cell.medium {
    background-color: #fff3cd;
    color: #664d03;
    font-weight: bold;
}

.stat-cell.low {
    background-color: #f8d7da;
    color: #721c24;
    font-weight: bold;
}

.action-buttons {
    white-space: nowrap;
}

/* ========================================
   TRACKS TABLE
   ======================================== */

.table-responsive {
    border-radius: 4px;
}

.track-table {
    margin-bottom: 0;
}

.track-table thead {
    background-color: var(--brand);
    color: white;
}

.track-table tbody tr:hover {
    background-color: #f1f3f5;
}

.stat-badge {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    padding: 4px 8px;
    background-color: #e7f1ff;
    color: var(--brand);
    border-radius: 3px;
}

.deg-badge {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    padding: 3px 6px;
    background-color: #fff3cd;
    color: #664d03;
}

.life-range {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.section-title {
    font-size: 0.75rem;
    font-weight: bold;
    color: #6c757d;
    text-transform: uppercase;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid #dee2e6;
}

/* ========================================
   TRACK DETAIL
   ======================================== */

.detail-header {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.detail-header h1 {
    margin: 0;
    font-size: 2.5rem;
}

.stat-card {
    border-left: 4px solid var(--brand);
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    color: var(--brand);
}

.stat-value.time {
    color: #28a745;
}

.stat-value.number {
    color: #fd7e14;
}

.selector-card {
    margin-bottom: 2rem;
}

.compound-section {
    margin-top: 2rem;
}

.compound-row {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid #dee2e6;
}

.compound-row.soft {
    border-left-color: #ff6b6b;
}

.compound-row.medium {
    border-left-color: #ffd43b;
}

.compound-row.hard {
    border-left-color: #74c0fc;
}

.compound-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.compound-name.soft { color: #ff6b6b; }
.compound-name.medium { color: #ffa500; }
.compound-name.hard { color: #74c0fc; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    padding: 1rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.info-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.info-value {
    font-size: 1.3rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

/* ========================================
   LAP BREAKDOWN TABLE (Race Dashboard)
   ======================================== */

.lap-breakdown-table {
    background: var(--surface-2);
    border-collapse: collapse;
    width: 100%;
    margin-top: 15px;
    border-radius: 4px;
    overflow: hidden;
}

.lap-breakdown-table thead {
    background: var(--surface-2);
}

.lap-breakdown-table th {
    color: #999;
    padding: 8px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-dark);
}

.lap-breakdown-table td {
    padding: 8px;
    border-bottom: 1px solid #3a3a3a;
    color: #fff;
    font-size: 12px;
}

.lap-breakdown-table tbody tr:hover {
    background: var(--surface-2);
}

.compound-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.compound-soft {
    background: #ff4444;
    color: white;
}

.compound-medium {
    background: #ffaa00;
    color: white;
}

.compound-hard {
    background: #cccccc;
    color: #333;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

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

    .strategies-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-content {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        grid-template-columns: 1fr;
    }

    .category-body {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .stat-row {
        grid-template-columns: 1fr;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 24px;
    }

    .detail-header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .track-selector-group {
        flex-direction: column;
        align-items: stretch;
    }

    .track-selector-group button {
        width: 100%;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button,
    .button-group a {
        width: 100%;
    }
}

/* ========================================
   NAVBAR
   ======================================== */

.pwp-navbar {
    background: var(--surface-0);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pwp-navbar .navbar-brand {
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.pwp-navbar .nav-link {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s;
}

.pwp-navbar .nav-link:hover {
    color: #fff;
}

.pwp-navbar .nav-link.active {
    color: #fff;
    position: relative;
}

.pwp-navbar .nav-link.active::after {
    content: '';
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: -2px;
    height: 2px;
    background: var(--brand-gradient);
    border-radius: 2px;
}

/* ========================================
   ERROR PAGE
   ======================================== */

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-light);
    padding: 20px;
}

.error-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px;
    max-width: 480px;
    text-align: center;
}

.error-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.error-card h1 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: var(--text-light-primary);
}

.error-card p {
    color: var(--text-light-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.error-card .btn-primary {
    display: inline-flex;
    text-decoration: none;
}

/* ========================================
   RACE DASHBOARD — extracted inline styles
   ======================================== */

.drivers-racing-bar {
    background: var(--surface-2);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--border-dark);
}

.drivers-racing-label {
    font-size: 12px;
    color: var(--text-dark-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.drivers-racing-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.driver-chip {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.driver-chip-current {
    background: var(--brand);
    border: 1px solid var(--brand);
    color: #fff;
}

.driver-chip-link {
    background: var(--surface-3);
    border: 1px solid var(--border-dark);
    color: #fff;
}

.driver-chip-link:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.detail-item-highlight {
    background: var(--surface-3);
    border: 2px solid var(--brand);
}

.detail-item-pace {
    background: var(--surface-3);
    border-left: 3px solid var(--good);
}

.detail-item-pace.pace-slower {
    border-left-color: var(--warn);
}

.detail-item-muted {
    background: var(--surface-3);
    color: var(--text-dark-muted);
}

.detail-value-lg { font-size: 16px; }
.detail-value-sm { font-size: 14px; }
.detail-value-xs { font-size: 12px; }

.text-good { color: var(--good) !important; }
.text-warn { color: var(--warn) !important; }

.expected-lap-box {
    background: var(--surface-3);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 15px;
    border-left: 3px solid var(--brand);
}

.expected-lap-label {
    font-size: 11px;
    color: var(--text-dark-muted);
    margin-bottom: 6px;
    letter-spacing: 0.04em;
}

.expected-lap-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.expected-lap-sublabel {
    font-size: 10px;
    color: var(--text-dark-muted);
}

.expected-lap-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--brand);
}

.alt-strategy-btn {
    background: var(--surface-2);
    border: 2px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: #fff;
    width: 100%;
}

.alt-strategy-btn:hover {
    border-color: var(--brand);
    background: var(--surface-3);
}

.alt-name {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.alt-delta-badge {
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.alt-delta-badge.badge-good { background: var(--good); }
.alt-delta-badge.badge-warn { background: var(--warn); }

.alt-total {
    font-size: 13px;
    color: #ccc;
    margin-bottom: 6px;
}

.alt-from-now {
    font-size: 12px;
    color: var(--text-dark-muted);
}

.alt-rank {
    font-size: 11px;
    color: var(--text-dark-muted);
}

/* ========================================
   RACE EVENTS (SC/VSC/rival pits)
   ======================================== */

.caution-banner {
    background: linear-gradient(135deg, #b8590f 0%, #8f3d0a 100%);
    color: #fff;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.event-log-hint {
    color: var(--text-dark-muted);
    font-size: 12.5px;
    margin-bottom: 16px;
}

.event-log-form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.event-log-form-row label {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: var(--text-dark-muted);
}

.event-log-form-row input,
.event-log-form-row select {
    margin-top: 4px;
    padding: 8px;
    border: 1px solid var(--border-dark);
    background: var(--surface-3);
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
}

.event-log-detail {
    flex: 1;
    min-width: 200px;
}

.event-log-form-row button {
    padding: 9px 18px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    height: 37px;
}

.event-log-form-row button:hover {
    background: var(--brand-dark);
}

.event-log-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
}

.event-log-item {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--surface-3);
    border-left: 3px solid var(--border-dark);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12.5px;
}

.event-log-item-sc_start,
.event-log-item-sc_end {
    border-left-color: var(--warn);
}

.event-log-item-vsc_start,
.event-log-item-vsc_end {
    border-left-color: #ffcc66;
}

.event-log-item-rival_pit {
    border-left-color: var(--brand);
}

.event-log-lap {
    font-weight: 700;
    color: var(--text-dark-muted);
    min-width: 55px;
}

.event-log-type {
    font-weight: 600;
    color: #fff;
}

.event-log-detail-text {
    color: var(--text-dark-muted);
}

.event-log-empty {
    color: var(--text-dark-muted);
    font-size: 12.5px;
}

.rival-reads {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-dark);
}

.rival-reads-label {
    font-size: 12px;
    color: var(--text-dark-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.rival-read-item {
    background: var(--surface-3);
    padding: 10px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 12.5px;
    color: #ddd;
}

.rival-read-good { color: var(--good); font-weight: 600; }
.rival-read-warn { color: var(--warn); font-weight: 600; }
.rival-read-gap { margin-top: 4px; }

.alt-rival-note {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-dark);
    font-size: 11px;
    color: var(--text-dark-muted);
}

.alt-hidden-note {
    font-size: 11.5px;
    color: var(--text-dark-muted);
    text-align: center;
    padding: 6px 0;
}

.pit-recorder {
    background: var(--surface-3);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 15px 0;
}

.pit-recorder-label {
    font-size: 12px;
    color: var(--text-dark-muted);
    margin-bottom: 10px;
}

.pit-recorder-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.pit-recorder-form label {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: var(--text-dark-muted);
}

.pit-recorder-form input,
.pit-recorder-form select {
    margin-top: 4px;
    padding: 7px;
    border: 1px solid var(--border-dark);
    background: var(--surface-2);
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
}

.pit-recorder-form button {
    padding: 8px 16px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    height: 35px;
}

.pit-recorder-form button:hover {
    background: var(--brand-dark);
}

.drivers-compare {
    background: var(--surface-2);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--border-dark);
}

.drivers-compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.driver-compare-card {
    background: var(--surface-3);
    border: 2px solid var(--border-dark);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.driver-compare-current {
    border-color: var(--brand);
}

.driver-compare-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    font-size: 14px;
    margin-bottom: 8px;
}

.driver-compare-you {
    font-size: 10px;
    text-transform: uppercase;
    background: var(--brand);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
}

.driver-compare-row {
    font-size: 12.5px;
    color: #ccc;
    margin-bottom: 5px;
}

.driver-compare-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--brand);
    text-decoration: none;
}

.driver-compare-link:hover {
    text-decoration: underline;
}

.tyre-health {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 11.5px;
    background: var(--surface-3);
}

.tyre-health-ok { color: var(--good); }
.tyre-health-warn { color: var(--warn); font-weight: 600; }
