/* RaceBox Web Dashboard — Dark Theme
 * Matches desktop app: #14141e bg, #e0e0f0 text, #1a1a28 panels */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Base ──────────────────────────────────────────────────── */
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #14141e;
    color: #e0e0f0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
}

body {
    display: flex;
    flex-direction: column;
}

/* ── Top Toolbar ───────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 36px;
    padding: 0 12px;
    background: #1a1a28;
    border-bottom: 1px solid #2a2a3a;
    flex-shrink: 0;
}

.toolbar .title {
    font-weight: 600;
    font-size: 13px;
    color: #e0e0f0;
    white-space: nowrap;
}

.toolbar .separator {
    width: 1px;
    height: 20px;
    background: #2a2a3a;
}

.toolbar .stat {
    font-size: 12px;
    color: #aaaabc;
    white-space: nowrap;
}

.toolbar .spacer {
    flex: 1;
}

/* Connection status dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}
.status-dot.connected    { background: #44cc88; box-shadow: 0 0 4px #44cc88; }
.status-dot.disconnected { background: #E94560; box-shadow: 0 0 4px #E94560; }

/* App download section in toolbar */
.app-download {
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #3a3a5a;
    border: 1px solid #4a4a6a;
    border-radius: 4px;
    color: #e0e0f0;
    text-decoration: none;
    font-size: 12px;
    white-space: nowrap;
    transition: background 0.15s;
}

.app-download-btn:hover {
    background: #4a4a6a;
}

.app-download-icon {
    font-size: 14px;
}

.app-download-ios {
    font-size: 11px;
    color: #888899;
    font-style: italic;
}

/* ── Dashboard Layout ──────────────────────────────────────── */
.dashboard {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;  /* allow flex shrink below content size */
}

/* Left column: 60% — speed header + map placeholder + data strip */
.left-column {
    display: flex;
    flex-direction: column;
    flex: 3;
    min-width: 0;
    position: relative;
}

/* Right column: 40% — 2x2 grid */
.right-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    flex: 2;
    min-width: 0;
    padding: 4px;
}

/* ── Speed Header ──────────────────────────────────────────── */
.speed-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 130px;
    flex-shrink: 0;
    padding: 4px;
}

.speed-header canvas {
    width: 120px;
    height: 120px;
}

/* ── Map Placeholder ───────────────────────────────────────── */
.map-area {
    flex: 1;
    position: relative;
    min-height: 0;
    z-index: 0;  /* establish stacking context for data strip vs Leaflet */
}

#map-container {
    width: 100%;
    height: 100%;
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6666a0;
    font-size: 16px;
}

/* ── Widget Panels ─────────────────────────────────────────── */
.widget-panel {
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.widget-panel canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── Data Strip ────────────────────────────────────────────── */
#data-strip {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    z-index: 1000;
    font-family: "Consolas", "JetBrains Mono", monospace;
    font-size: 11px;
    pointer-events: none;  /* Allow clicks through to map */
}

#data-strip .toggle-btn {
    display: block;
    width: 50px;
    height: 20px;
    background: #2a2a3e;
    color: #e0e0f0;
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    text-align: center;
    pointer-events: auto;  /* Button is clickable */
}
#data-strip .toggle-btn:hover {
    background: #4a4a62;
    color: #ffffff;
}

#data-strip .strip-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

#data-strip .strip-sep {
    width: 1px;
    height: 16px;
    background: #2a2a3a;
    margin: 0 4px;
}

#data-strip .ds-label {
    color: #8888a0;
    font-size: 10px;
}

#data-strip .ds-value {
    color: #e0e0f0;
    font-size: 11px;
    font-family: "Consolas", "JetBrains Mono", monospace;
}

#data-strip .ds-value.header {
    color: #00cc88;
    font-weight: bold;
}

/* Color coding for fix type */
#data-strip .ds-value.fix-3d    { color: #00cc66; }
#data-strip .ds-value.fix-2d    { color: #ffcc00; }
#data-strip .ds-value.fix-none  { color: #ff4444; }

/* Color coding for battery */
#data-strip .ds-value.bat-high  { color: #00cc66; }
#data-strip .ds-value.bat-med   { color: #ffcc00; }
#data-strip .ds-value.bat-low   { color: #ff4444; }

/* Color coding for satellite count */
#data-strip .ds-value.sat-good  { color: #00cc66; }
#data-strip .ds-value.sat-ok    { color: #ffcc00; }
#data-strip .ds-value.sat-poor  { color: #ff4444; }

/* Color coding for gyro SNR quality */
#data-strip .ds-value.snr-good  { color: #00cc66; }
#data-strip .ds-value.snr-ok    { color: #ffcc00; }
#data-strip .ds-value.snr-poor  { color: #ff4444; }

/* Data strip expand/collapse transition */
#data-strip .strip-content {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    padding: 4px 8px;
    align-items: center;
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
    background: #1a1a28;
    border-top: 1px solid #2a2a3a;
    pointer-events: auto;  /* Content is interactive */
}

#data-strip .strip-content.collapsed {
    max-height: 0;
    padding: 0 8px;
    border-top: none;
}

/* ── Full-Window Map ──────────────────────────────────────── */
.map-fullwindow {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1000;
    flex: none !important;
}

.map-fullwindow #map-container {
    width: 100%;
    height: 100%;
}

/* No GPS Fix Overlay */
.map-no-fix-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 30, 0.85);
    color: #8888a0;
    font-size: 16px;
    z-index: 500;
    pointer-events: none;
}

/* HUD Overlay (full-window map mode) */
.map-hud-overlay {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(20, 20, 30, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 24px;
    z-index: 1001;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.hud-speed {
    font-size: 42px;
    font-weight: 700;
    color: #e0e0f0;
    font-family: "Consolas", "JetBrains Mono", monospace;
    line-height: 1;
}

.hud-speed small {
    font-size: 16px;
    font-weight: 400;
    color: #8888a0;
}

.hud-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.hud-item {
    font-size: 14px;
    color: #c8c8dc;
    font-family: "Consolas", "JetBrains Mono", monospace;
}

.hud-sep {
    color: #3a3a50;
    font-size: 14px;
}

/* ── Rider Selection Page ──────────────────────────────────── */
#rider-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 20px;
    overflow-y: auto;
}

.selection-header {
    text-align: center;
    margin-bottom: 40px;
}

.selection-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #e0e0f0;
    margin-bottom: 8px;
}

.selection-subtitle {
    font-size: 14px;
    color: #8888a0;
}

.rider-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 420px;
}

.rider-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #8888a0;
    font-size: 14px;
    padding: 40px 0;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #2a2a3a;
    border-top-color: #44cc88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.rider-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.rider-card:hover {
    border-color: #44cc88;
    background: #1e1e30;
}

.rider-card-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.rider-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.rider-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0f0;
}

.rider-card-id {
    font-size: 11px;
    color: #6666a0;
    font-family: "Consolas", "JetBrains Mono", monospace;
}

.rider-card-arrow {
    font-size: 14px;
    color: #6666a0;
    flex-shrink: 0;
}

.rider-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #44cc88;
    box-shadow: 0 0 4px #44cc88;
    margin-right: 6px;
    vertical-align: middle;
}

/* ── Session List Page ────────────────────────────────────── */
#session-list-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.session-list-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
}

.session-list-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #e0e0f0;
    flex: 1;
}

.import-csv-btn {
    background: #2a2a3e;
    color: #e0e0f0;
    border: 1px solid #3a3a50;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}
.import-csv-btn:hover {
    background: #3a3a52;
    border-color: #44cc88;
}
.import-csv-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lean-method-select {
    background: #2a2a3e;
    color: #e0e0f0;
    border: 1px solid #3a3a50;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    appearance: auto;
    transition: background 0.2s, border-color 0.2s;
}
.lean-method-select:hover {
    background: #3a3a52;
    border-color: #44cc88;
}
.lean-method-select option {
    background: #1e1e2e;
    color: #e0e0f0;
}

.session-list-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 500px;
}

.session-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: 12px 16px;
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    width: 100%;
}
.session-card:hover {
    border-color: #44cc88;
    background: #1e1e30;
}

.session-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.session-card-date {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0f0;
}

.session-card-meta {
    font-size: 11px;
    color: #8888a0;
}

.session-delete-btn {
    background: none;
    border: none;
    color: #8888a0;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.session-delete-btn:hover {
    color: #E94560;
    background: rgba(233, 69, 96, 0.1);
}

/* Session card main row (when detail panel present) */
.session-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}
.session-card-main .session-card-info {
    flex: 1;
}

/* Quality indicator on session cards */
.quality-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-family: "Consolas", "JetBrains Mono", monospace;
    color: #8888a0;
    white-space: nowrap;
    padding: 0 4px;
}

.quality-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.quality-dot.quality-good { background: #00cc66; }
.quality-dot.quality-ok   { background: #ffcc00; }
.quality-dot.quality-poor { background: #ff4444; }
.quality-dot.quality-none { background: #555566; }

/* Quality detail panel */
.quality-detail {
    width: 100%;
    padding: 8px 0 0 0;
    border-top: 1px solid #2a2a3a;
    margin-top: 8px;
}

.quality-detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    font-size: 12px;
}

.qd-label {
    color: #8888a0;
    font-size: 11px;
}

.qd-value {
    color: #e0e0f0;
    font-family: "Consolas", "JetBrains Mono", monospace;
    font-size: 12px;
}

.qd-value.quality-good { color: #00cc66; }
.qd-value.quality-ok   { color: #ffcc00; }
.qd-value.quality-poor { color: #ff4444; }

.quality-replay-btn {
    display: block;
    margin-top: 8px;
    padding: 6px 16px;
    background: #2a2a3e;
    color: #00cc88;
    border: 1px solid #3a3a50;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    width: 100%;
    text-align: center;
}
.quality-replay-btn:hover {
    background: #3a3a50;
    border-color: #44cc88;
}

.live-session-card {
    border-color: #44cc88;
    background: #1a2820;
}
.live-session-card:hover {
    background: #1e3028;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6666a0;
}

.empty-state p {
    margin: 8px 0;
    font-size: 16px;
}

.empty-state p:first-child {
    font-size: 18px;
    color: #aaaabc;
}

/* ── Replay Control Bar ───────────────────────────────────── */
#replay-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 12px;
    background: #1a1a28;
    border-top: 1px solid #2a2a3a;
    flex-shrink: 0;
    width: 100%;
}

.replay-btn {
    background: #2a2a3e;
    color: #e0e0f0;
    border: 1px solid #3a3a50;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.replay-btn:hover:not(:disabled) {
    background: #4a4a62;
}
.replay-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.replay-scrubber {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #2a2a3a;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.replay-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #44cc88;
    cursor: pointer;
}

.replay-position {
    font-size: 11px;
    color: #8888a0;
    font-family: "Consolas", "JetBrains Mono", monospace;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

.replay-speed {
    background: #2a2a3e;
    color: #e0e0f0;
    border: 1px solid #3a3a50;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
}

/* ── Toolbar Additions ────────────────────────────────────── */
.toolbar-back-btn {
    background: none;
    border: none;
    color: #aaaabc;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.toolbar-back-btn:hover {
    color: #e0e0f0;
    background: #2a2a3e;
}

.toolbar-btn {
    background: #2a2a3e;
    border: 1px solid #3a3a50;
    color: #aaaabc;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 4px;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.toolbar-btn:hover {
    color: #e0e0f0;
    background: #3a3a52;
    border-color: #4a4a66;
}

.mode-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 3px;
    white-space: nowrap;
}
.mode-badge.live {
    color: #44cc88;
    background: rgba(68, 204, 136, 0.15);
}
.mode-badge.replay {
    color: #ffaa44;
    background: rgba(255, 170, 68, 0.15);
}

/* ── Blocking Overlay (for import/long operations) ─────────── */
.blocking-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(20, 20, 30, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blocking-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px 48px;
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.blocking-overlay-content .spinner {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

#blocking-overlay-text {
    font-size: 16px;
    color: #e0e0f0;
    text-align: center;
}

/* ── Auth Pages ────────────────────────────────────────────── */
#login-page,
#register-page,
#confirm-page,
#forgot-password-page,
#reset-password-page {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 20px;
}

.auth-container {
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.auth-container h1 {
    font-size: 24px;
    font-weight: 700;
    color: #e0e0f0;
    margin-bottom: 32px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.auth-form .form-group label {
    font-size: 12px;
    color: #aaaabc;
    margin-bottom: 6px;
}

.auth-form .form-group input[type="email"],
.auth-form .form-group input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 6px;
    color: #e0e0f0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.auth-form .form-group input[type="email"]:focus,
.auth-form .form-group input[type="password"]:focus {
    border-color: #44cc88;
}

.auth-form .form-group.checkbox {
    flex-direction: row;
    align-items: center;
}

.auth-form .form-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #aaaabc;
    margin-bottom: 0;
    cursor: pointer;
}

.auth-form .form-group.checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #44cc88;
}

.form-error {
    padding: 10px 12px;
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid #E94560;
    border-radius: 6px;
    color: #E94560;
    font-size: 13px;
    text-align: center;
}

.form-success {
    padding: 10px 12px;
    background: rgba(68, 204, 136, 0.1);
    border: 1px solid #44cc88;
    border-radius: 6px;
    color: #44cc88;
    font-size: 13px;
    text-align: center;
    margin-bottom: 16px;
}

.auth-submit-btn {
    width: 100%;
    padding: 12px 16px;
    background: #44cc88;
    border: none;
    border-radius: 6px;
    color: #14141e;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.auth-submit-btn:hover {
    background: #55dd99;
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.auth-links a {
    font-size: 13px;
    color: #6666a0;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: #44cc88;
}

.confirm-message {
    color: #aaaabc;
    font-size: 14px;
    text-align: center;
    margin-bottom: 12px;
}

.confirm-message strong {
    color: #e0e0f0;
}

.password-hints {
    font-size: 11px;
    color: #6666a0;
    margin-top: 6px;
}

/* ── Admin Page ────────────────────────────────────────────── */
#admin-page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.admin-container {
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.admin-users-list {
    background: #1a1a28;
    border-radius: 8px;
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 12px 16px;
    background: #22222e;
    color: #8888a0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2a2a3a;
}

.admin-table td {
    padding: 12px 16px;
    color: #e0e0f0;
    font-size: 14px;
    border-bottom: 1px solid #22222e;
}

.admin-user-row {
    cursor: pointer;
    transition: background 0.15s;
}

.admin-user-row:hover {
    background: #22222e;
}

.admin-user-row:last-child td {
    border-bottom: none;
}

.status-verified {
    color: #44cc88;
}

.status-unverified {
    color: #E94560;
}

/* ── Responsive: stack on small screens ────────────────────── */
@media (max-width: 800px) {
    .dashboard {
        flex-direction: column;
    }
    .left-column,
    .right-column {
        flex: none;
        width: 100%;
    }
    .right-column {
        height: 50vh;
    }
}

/* ── Mobile Layout Foundation ─────────────────────────────────────── */

/* Mobile breakpoint: 768px (standard phone/tablet boundary) */
@media (max-width: 768px) {
    /* Mark body as mobile via CSS (JS can also add .mobile-layout class) */
    body {
        --mobile-mode: 1;
    }
    
    /* Toolbar adjustments for mobile */
    .toolbar {
        height: 44px;  /* Minimum touch target height */
        padding: 0 8px;
        gap: 8px;
    }
    
    .toolbar .title {
        font-size: 12px;
    }
    
    .toolbar .stat {
        font-size: 11px;
    }
    
    /* Hide non-essential toolbar items on mobile */
    .toolbar .separator:not(:first-of-type),
    #msg-rate,
    #app-download,
    .toolbar .title,
    #status-text {
        display: none;
    }
    
    /* Compact back button styling for mobile */
    #nav-back-btn {
        padding: 4px 8px;
        font-size: 14px;
    }
}

/* Portrait-specific styles */
@media (max-width: 768px) and (orientation: portrait) {
    body {
        --orientation: portrait;
    }
}

/* Landscape-specific styles */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        --orientation: landscape;
    }
    
    /* Landscape: even more compact toolbar */
    .toolbar {
        height: 36px;
    }
}

/* Safe area handling for notched phones */
@supports (padding: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        .toolbar {
            padding-top: env(safe-area-inset-top, 0);
            padding-left: env(safe-area-inset-left, 8px);
            padding-right: env(safe-area-inset-right, 8px);
        }
    }
}

/* DEBUG: Visual mobile indicator - REMOVED for production (Phase 82-02) */
/* Previously showed "MOBILE MODE" / "MOBILE (PORTRAIT)" / "MOBILE (LANDSCAPE)" badges */

/* ── Fix Leaflet Tile Seams ─────────────────────────────────────────── */
/* Prevents visible lines between map tiles (browser sub-pixel rendering issue) */
.leaflet-tile-pane {
    /* Force GPU layer to prevent tile seams */
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

.leaflet-tile {
    /* Multiple fixes for tile seams */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    
    /* Slight overlap to hide seams */
    margin: -0.5px;
    padding: 0.5px;
    
    /* Force pixel-perfect rendering */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.leaflet-tile-container {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
}

/* Alternative: slightly scale up tiles to overlap */
.leaflet-tile-loaded {
    transform: scale(1.002);
    transform-origin: center center;
}

/* ── Hide Leaflet Attribution on Mobile ─────────────────────────────── */
/* Attribution is preserved on desktop for license compliance */
@media (max-width: 768px) {
    .leaflet-control-attribution {
        display: none !important;
    }
    
    /* Hide zoom controls on mobile - users can pinch to zoom */
    .leaflet-control-zoom {
        display: none !important;
    }
}

/* ── Mobile Map-Dominant Layout ───────────────────────────────────── */
/* Transforms desktop 60/40 split into fullscreen map with overlays */

@media (max-width: 768px) {
    /* Dashboard becomes a stack container for map and overlays */
    .dashboard {
        display: block;
        position: relative;
        flex: 1;
        overflow: hidden;
    }
    
    /* Hide desktop layout columns */
    .left-column {
        display: contents; /* Flatten - children participate in parent layout */
    }
    
    .right-column {
        display: none; /* Hide desktop gauge grid - will be replaced by overlays */
    }
    
    /* Speed header becomes overlay */
    .speed-header {
        display: none; /* Hidden - speed will be overlay in Phase 82 */
    }
    
    /* Map fills viewport */
    .map-area {
        position: fixed !important;
        top: 44px; /* Below toolbar (mobile toolbar height) */
        left: 0;
        right: 0;
        bottom: 40px; /* Above replay bar */
        z-index: 1;
        flex: none !important;
    }
    
    #map-container {
        width: 100%;
        height: 100%;
        border: none; /* Remove desktop border */
    }
    
    /* Data strip hidden on mobile (too dense for small screens) */
    #data-strip {
        display: none;
    }
    
    /* Replay bar stays at bottom */
    #replay-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        height: 40px;
        /* Safe area padding for notched phones */
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}

/* Landscape adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .map-area {
        top: 36px; /* Landscape has smaller toolbar */
    }
    
    /* Safe area for landscape notch (left/right sides) */
    .map-area {
        left: env(safe-area-inset-left, 0);
        right: env(safe-area-inset-right, 0);
    }
}

/* ── Mobile Gauge Overlays ────────────────────────────────────────── */
/* Gauges render as transparent overlays over the map */

/* Hidden on desktop by default */
.gauge-overlay-container {
    display: none;
}

@media (max-width: 768px) {
    /* Overlay container - visible and positioned on mobile */
    .gauge-overlay-container {
        display: block;
        position: fixed;
        top: 44px;
        left: 0;
        right: 0;
        bottom: 40px;
        z-index: 10;
        pointer-events: none; /* Allow map interaction through container */
        /* Safe area padding */
        padding: env(safe-area-inset-top, 8px) 
                 env(safe-area-inset-right, 8px) 
                 env(safe-area-inset-bottom, 8px) 
                 env(safe-area-inset-left, 8px);
    }
    
    /* Individual gauge overlay wrapper */
    .gauge-overlay {
        position: absolute;
        pointer-events: auto; /* Re-enable interaction on actual gauges */
        /* Fully transparent - gauge content floats directly over map */
        background: transparent;
        border: none;
        border-radius: 0;
        overflow: visible;
    }
    
    /* Gauge canvas inside overlay - fill container completely */
    .gauge-overlay canvas {
        width: 100% !important;
        height: 100% !important;
        display: block;
        object-fit: contain;
    }
    
    /* Touch optimization for gauge controls */
    .gauge-overlay button,
    .gauge-overlay [role="button"] {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ── Gauge Overlay Positions ────────────────────────────────────────── */

@media (max-width: 768px) {
    /* Speed gauge: top-center, same size as corner gauges */
    .gauge-overlay.top-center {
        left: 50%;
        transform: translateX(-50%);
        top: 8px;
        width: min(22vmin, 130px);
        height: min(22vmin, 130px);
        min-width: 80px;
        min-height: 80px;
    }
    
    /* Corner gauges: ~22% of viewport smaller dimension */
    .gauge-overlay.top-left,
    .gauge-overlay.top-right,
    .gauge-overlay.bottom-left,
    .gauge-overlay.bottom-right {
        width: min(22vmin, 130px);
        height: min(22vmin, 130px);
        min-width: 80px;
        min-height: 80px;
    }
    
    /* Top-left corner */
    .gauge-overlay.top-left {
        left: 8px;
        top: 8px;
    }
    
    /* Top-right corner */
    .gauge-overlay.top-right {
        right: 8px;
        top: 8px;
    }
    
    /* Bottom-left corner (above replay bar) */
    .gauge-overlay.bottom-left {
        left: 8px;
        bottom: 8px;
    }
    
    /* Bottom-right corner (above replay bar) */
    .gauge-overlay.bottom-right {
        right: 8px;
        bottom: 8px;
    }
}

/* Landscape gauge overlay adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .gauge-overlay-container {
        top: 36px;
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }
    
    /* Smaller gauges in landscape to fit horizontal space */
    .gauge-overlay.top-center {
        width: min(20vh, 140px);
        height: min(20vh, 140px);
        min-width: 80px;
        min-height: 80px;
    }
    
    .gauge-overlay.top-left,
    .gauge-overlay.top-right,
    .gauge-overlay.bottom-left,
    .gauge-overlay.bottom-right {
        width: min(18vh, 110px);
        height: min(18vh, 110px);
        min-width: 70px;
        min-height: 70px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CUSTOM LEAFLET BOTTOM-CENTER POSITION
   Custom position class for Leaflet controls (recenter button on mobile)
   ═══════════════════════════════════════════════════════════════════════════ */

.leaflet-bottom.leaflet-center {
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Mobile recenter button: reposition to bottom-center via CSS transform */
@media (max-width: 768px) {
    /* Move the bottom-right control container to center */
    .leaflet-bottom.leaflet-right {
        /* Reset from right side */
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%);
        /* Stack controls in center */
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .leaflet-recenter-btn {
        /* Transparent background matching gauge overlays */
        background: rgba(20, 20, 30, 0.6) !important;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border: 1px solid rgba(0, 150, 255, 0.4);
        padding: 10px 20px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
        /* Position just above replay bar (40px) with minimal margin */
        margin-bottom: 8px !important;
        /* Touch-friendly sizing */
        min-height: 44px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    .leaflet-recenter-btn:active {
        background: rgba(0, 150, 255, 0.7) !important;
    }
}

/* Landscape mobile: adjust for smaller replay bar area */
@media (max-width: 768px) and (orientation: landscape) {
    .leaflet-recenter-btn {
        padding: 8px 16px !important;
        font-size: 12px !important;
        min-height: 36px;
        margin-bottom: 6px !important;
    }
}

/* ── Import Dropdown Menu ────────────────────────────────────────────── */
.import-dropdown {
    position: relative;
    display: inline-block;
}

.import-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    min-width: 160px;
    z-index: 1000;
    overflow: hidden;
}

.import-dropdown-menu.open {
    display: block;
}

.import-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: #e0e0f0;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
}

.import-dropdown-menu button:hover {
    background: #2a2a3a;
}

/* ── Batch Import Progress Banner ────────────────────────────────────── */
.batch-progress-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #1a1a28 0%, #252538 100%);
    border-bottom: 1px solid #2a2a3a; /* Match toolbar border */
    height: 36px; /* Match toolbar height */
    padding: 0 12px; /* Match toolbar padding */
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.batch-progress-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px; /* Match toolbar font size */
    color: #e0e0f0;
    flex-shrink: 0;
}

#batch-progress-label {
    font-weight: 600;
}

.batch-filtered-notice {
    font-size: 12px;
    color: #aaaabc;
}

.batch-progress-bar-container {
    flex: 1;
    height: 4px; /* Slimmer bar to fit toolbar height */
    background: #2a2a3a;
    border-radius: 2px;
    overflow: hidden;
}

.batch-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0096ff 0%, #00c8ff 100%);
    border-radius: 2px;
    transition: width 0.2s ease-out;
}

/* Batch progress banner mobile - match toolbar heights */
@media (max-width: 768px) {
    .batch-progress-banner {
        height: 44px; /* Match mobile toolbar height */
        padding: 0 8px;
        gap: 8px;
    }
    
    .batch-progress-text {
        font-size: 12px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .batch-progress-banner {
        height: 36px; /* Match landscape toolbar height */
    }
}

/* ── Batch Import Toast Notification ─────────────────────────────────── */
.batch-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    padding: 16px 20px;
    min-width: 280px;
    max-width: 400px;
    animation: toast-slide-in 0.3s ease-out;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.batch-toast.toast-hiding {
    animation: toast-slide-out 0.3s ease-in forwards;
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.batch-toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.batch-toast-title {
    font-weight: 600;
    font-size: 15px;
    color: #e0e0f0;
}

.batch-toast-close {
    background: transparent;
    border: none;
    color: #aaaabc;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.batch-toast-close:hover {
    color: #e0e0f0;
}

.batch-toast-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.batch-toast-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.batch-toast-stat.success { color: #44cc88; }
.batch-toast-stat.warning { color: #ffaa44; }
.batch-toast-stat.error { color: #E94560; }

.batch-toast-stat-icon {
    font-size: 14px;
}

.batch-toast-actions {
    display: flex;
    justify-content: flex-end;
}

.batch-toast-btn {
    background: #3a3a5a;
    border: 1px solid #4a4a6a;
    color: #e0e0f0;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.batch-toast-btn:hover {
    background: #4a4a6a;
}

.batch-toast-btn.hidden {
    display: none;
}

/* Sensor Quality Section (Phase 89) */
.batch-toast-sensor-quality {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    margin-bottom: 8px;
    border-top: 1px solid #2a2a3a;
}

.batch-toast-sensor-title {
    font-size: 12px;
    color: #aaaabc;
    font-weight: 500;
}

.batch-toast-sensor-detail {
    font-size: 11px;
    color: #888899;
    width: 100%;
    margin-top: 4px;
}

/* ── Batch Import Error Modal ────────────────────────────────────────── */
.batch-error-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.batch-error-modal {
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modal-scale-in 0.2s ease-out;
}

@keyframes modal-scale-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.batch-error-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #2a2a3a;
}

.batch-error-modal-title {
    font-weight: 600;
    font-size: 16px;
    color: #E94560;
    display: flex;
    align-items: center;
    gap: 8px;
}

.batch-error-modal-close {
    background: transparent;
    border: none;
    color: #aaaabc;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.batch-error-modal-close:hover {
    color: #e0e0f0;
}

.batch-error-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.batch-error-category {
    margin-bottom: 16px;
}

.batch-error-category:last-child {
    margin-bottom: 0;
}

.batch-error-category-header {
    font-weight: 600;
    font-size: 14px;
    color: #aaaabc;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.batch-error-category-count {
    background: #2a2a3a;
    color: #e0e0f0;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: normal;
}

.batch-error-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.batch-error-item {
    padding: 8px 12px;
    background: #14141e;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 13px;
}

.batch-error-item:last-child {
    margin-bottom: 0;
}

.batch-error-filename {
    color: #e0e0f0;
    font-weight: 500;
}

.batch-error-message {
    color: #aaaabc;
    margin-top: 4px;
    font-size: 12px;
}

.batch-error-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #2a2a3a;
    display: flex;
    justify-content: flex-end;
}

.batch-error-modal-btn {
    background: #3a3a5a;
    border: 1px solid #4a4a6a;
    color: #e0e0f0;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.batch-error-modal-btn:hover {
    background: #4a4a6a;
}

/* ── Event Status Dot ─────────────────────────────────────────── */
.event-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}
.event-status-dot.connected {
    background: #44cc88;
    box-shadow: 0 0 4px #44cc88;
}
.event-status-dot.reconnecting {
    background: #ffaa44;
    box-shadow: 0 0 4px #ffaa44;
}
.event-status-dot.disconnected {
    background: #666680;
    box-shadow: none;
}

/* ── Event Toast ──────────────────────────────────────────────── */
/* Positioned bottom-right, same as batch-toast for consistency */
.event-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9997;
    background: #1a1a28; /* Match batch-toast background */
    border: 1px solid #2a2a3a; /* Match batch-toast border */
    border-radius: 8px;
    padding: 10px 16px;
    color: #e0e0f0;
    font-size: 13px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); /* Match batch-toast shadow */
    max-width: 320px;
    animation: toast-slide-in 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
}
.event-toast.toast-hiding {
    animation: toast-slide-out 0.3s ease-in forwards;
}
.event-toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* ── Event Highlight Effect ───────────────────────────────────── */
@keyframes event-highlight-fade {
    0%   { box-shadow: 0 0 0 2px #44cc88, 0 0 12px rgba(68,204,136,0.4); }
    100% { box-shadow: none; }
}
.rider-card.event-highlight,
.session-card.event-highlight {
    animation: event-highlight-fade 1.5s ease-out forwards;
}

/* ── Garage Page ───────────────────────────────────────────── */
#garage-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 16px;
}

.garage-container {
    flex: 1;
    overflow-y: auto;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.garage-rider-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 80px; /* space for FAB */
}

/* Rider card in garage list */
.garage-rider-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.garage-rider-card:hover {
    background: #22222e;
    border-color: #3a3a4a;
}

.garage-rider-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #2a2a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.garage-rider-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.garage-rider-avatar .avatar-placeholder {
    font-size: 24px;
    color: #6666a0;
}

.garage-rider-info {
    flex: 1;
    min-width: 0;
}

.garage-rider-name {
    font-size: 15px;
    font-weight: 600;
    color: #e0e0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.garage-rider-meta {
    font-size: 12px;
    color: #8888a0;
    margin-top: 2px;
}

.garage-default-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #3a5a3a;
    color: #88cc88;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.garage-default-badge::before {
    content: "★";
}

.garage-rider-actions {
    display: flex;
    gap: 8px;
}

.garage-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #3a3a4a;
    background: #2a2a3a;
    color: #aaaabc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.garage-action-btn:hover {
    background: #3a3a4a;
    color: #e0e0f0;
}

.garage-action-btn.danger:hover {
    background: #4a2a2a;
    color: #ff6666;
    border-color: #6a3a3a;
}

/* FAB button */
.garage-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #4a8cff;
    border: none;
    color: white;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(74, 140, 255, 0.4);
    transition: transform 0.15s, box-shadow 0.15s;
    z-index: 100;
}

.garage-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(74, 140, 255, 0.5);
}

.garage-fab:active {
    transform: scale(0.95);
}

/* Empty state */
.garage-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.garage-empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.garage-empty-state h3 {
    font-size: 18px;
    color: #e0e0f0;
    margin-bottom: 8px;
}

.garage-empty-state p {
    font-size: 14px;
    color: #8888a0;
    max-width: 300px;
}

/* ── Rider Modal ───────────────────────────────────────────── */
.rider-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.rider-modal {
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.rider-modal-small {
    max-width: 360px;
}

.rider-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #2a2a3a;
}

.rider-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0f0;
    margin: 0;
}

.rider-modal-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #8888a0;
    font-size: 20px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rider-modal-close-btn:hover {
    background: #2a2a3a;
    color: #e0e0f0;
}

.rider-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.rider-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #2a2a3a;
}

/* Avatar section in modal */
.rider-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.rider-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #2a2a3a;
    border: 2px dashed #3a3a4a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.rider-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rider-avatar-placeholder {
    font-size: 40px;
    color: #6666a0;
}

.rider-avatar-actions {
    display: flex;
    gap: 8px;
}

/* Form sections */
.rider-form-section {
    margin-bottom: 20px;
}

.rider-form-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #8888a0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2a2a3a;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* Modal buttons */
.rider-btn-primary {
    padding: 10px 20px;
    background: #4a8cff;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.rider-btn-primary:hover {
    background: #5a9cff;
}

.rider-btn-primary:disabled {
    background: #3a4a5a;
    color: #8888a0;
    cursor: not-allowed;
}

.rider-btn-secondary {
    padding: 10px 20px;
    background: #2a2a3a;
    border: 1px solid #3a3a4a;
    border-radius: 6px;
    color: #e0e0f0;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.rider-btn-secondary:hover {
    background: #3a3a4a;
}

.rider-btn-danger {
    padding: 10px 20px;
    background: #cc4444;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.rider-btn-danger:hover {
    background: #dd5555;
}

.rider-btn-danger-small {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #6a3a3a;
    border-radius: 4px;
    color: #cc6666;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.rider-btn-danger-small:hover {
    background: #3a2a2a;
}

/* Required field indicator */
.required {
    color: #ff6666;
}


/* ── Live Ended Overlay ────────────────────────────────────── */
.live-ended-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(20, 20, 30, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.live-ended-content {
    text-align: center;
    padding: 40px;
}

.live-ended-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.live-ended-reason {
    font-size: 24px;
    font-weight: 600;
    color: #e0e0f0;
    margin-bottom: 30px;
}

.live-ended-btn {
    padding: 12px 24px;
    background: #3a3a5a;
    border: 1px solid #4a4a6a;
    border-radius: 8px;
    color: #e0e0f0;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.live-ended-btn:hover {
    background: #4a4a6a;
    transform: translateY(-1px);
}

.live-ended-btn:active {
    transform: translateY(0);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
