/* ==========================================================================
   Cars With Jack Road Trip Tracker - CSS Design System (Dark Mode Glassmorphism)
   ========================================================================== */

:root {
    --bg-color: #0b0f19;
    --panel-bg: rgba(15, 23, 42, 0.85); /* slate-900 glassmorphism */
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-glow: rgba(129, 140, 248, 0.08);
    --card-bg: rgba(30, 41, 59, 0.45); /* slate-800 transparency */
    --card-border: rgba(255, 255, 255, 0.06);
    
    --text-primary: #f8fafc;    /* slate-50 */
    --text-secondary: #94a3b8;  /* slate-400 */
    --text-muted: #64748b;      /* slate-500 */
    
    --accent-indigo: #818cf8;   /* indigo-400 */
    --accent-indigo-rgb: 129, 140, 248;
    --accent-green: #34d399;
    --accent-orange: #fbbf24;
    --accent-red: #f87171;
    --youtube-red: #ff0000;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 20px 40px rgba(0, 0, 0, 0.4);
    
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Helper Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.margin-top { margin-top: 16px; }
.text-orange { color: var(--accent-orange); }
.text-indigo { color: var(--accent-indigo); }

/* ==========================================================================
   Leaflet Map Light Mode Custom Styling
   ========================================================================== */

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    background-color: #e5e9f0;
}

/* Custom Zoom Controls to Match Light Mode */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-premium) !important;
}

.leaflet-control-zoom a {
    background: var(--panel-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--panel-border) !important;
    backdrop-filter: blur(12px);
    transition: var(--transition-fast);
}

.leaflet-control-zoom a:hover {
    background: var(--accent-indigo) !important;
    color: #fff !important;
    border-color: var(--accent-indigo) !important;
}

/* Light Glassmorphic Popups */
.leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    color: var(--text-primary) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-large) !important;
}

.leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.9) !important;
    border-left: 1px solid var(--panel-border);
    border-bottom: 1px solid var(--panel-border);
}

.leaflet-popup-content {
    margin: 14px 18px !important;
    line-height: 1.5;
}

/* ==========================================================================
   Overlay Fullscreens (Waiting & Finished States)
   ========================================================================== */

.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(241, 245, 249, 0.6); /* slate-100 trans */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: var(--transition-normal);
}

.overlay-screen.active {
    display: flex;
}

.splash-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 32px;
    padding: 48px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-large);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.channel-logo {
    width: 80px;
    height: 80px;
    background: rgba(var(--accent-indigo-rgb), 0.08);
    border: 1px solid rgba(var(--accent-indigo-rgb), 0.15);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.splash-card h1 {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.trip-badge {
    font-family: var(--font-heading);
    background: rgba(var(--accent-indigo-rgb), 0.1);
    color: var(--accent-indigo);
    border: 1px solid rgba(var(--accent-indigo-rgb), 0.15);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trip-badge.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border-color: rgba(16, 185, 129, 0.15);
}

.splash-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 4px 0;
}

.status-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    border: 1px solid rgba(0, 0, 0, 0.03);
    padding: 12px 20px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Subscribe & Social buttons */
.social-links {
    width: 100%;
    margin-top: 10px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition-fast);
}

.social-btn.youtube {
    background: var(--youtube-red);
    color: #fff;
    box-shadow: 0 4px 14px rgba(255, 0, 0, 0.2);
}

.social-btn.youtube:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.3);
}

/* Stats dashboard inside cover */
.final-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
    margin: 8px 0;
}

.final-stat-card {
    background: #f8fafc;
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.final-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.final-stat-val {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    color: var(--accent-indigo);
}

.final-stat-unit {
    font-size: 10px;
    color: var(--text-muted);
}

.action-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 8px;
}

.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent-indigo);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 14px rgba(var(--accent-indigo-rgb), 0.2);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--accent-indigo-rgb), 0.3);
}

/* ==========================================================================
   Sidebar overlay (Active State)
   ========================================================================== */

.sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    bottom: 20px;
    width: 380px;
    z-index: 10;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-normal);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    transform: translateX(-400px);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Sidebar Toggle button */
.sidebar-toggle-btn {
    position: absolute;
    right: -42px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 60px;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-left: none;
    border-radius: 0 12px 12px 0;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 11;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 0 10px rgba(0,0,0,0.02);
    transition: var(--transition-fast);
}

.sidebar-toggle-btn:hover {
    color: var(--accent-indigo);
    background: #fff;
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

/* Header */
.app-header {
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--panel-border);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    cursor: pointer;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(var(--accent-indigo-rgb), 0.08);
    border: 1px solid rgba(var(--accent-indigo-rgb), 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-indigo);
    font-size: 20px;
}

.logo-area h1 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: var(--text-primary);
}

.subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

/* Timer card block */
.live-status-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px 16px;
    border: 1px solid var(--panel-border);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-dot.pulsing {
    animation: statusPulse 2s infinite;
}

.status-dot.online {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-dot.offline {
    background-color: var(--accent-red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.status-dot.warning {
    background-color: var(--accent-orange);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.status-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Timer SVG */
.countdown-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.countdown-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.04);
    stroke-width: 3.5;
}

.countdown-bar {
    fill: none;
    stroke: var(--accent-indigo);
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dasharray 1s linear;
}

.countdown-number {
    position: absolute;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-heading);
    color: var(--text-primary);
}

/* ==========================================================================
   Sidebar: Content / Stats
   ========================================================================== */

.vehicles-section {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.vehicles-section::-webkit-scrollbar {
    width: 5px;
}

.vehicles-section::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Mileage Hero Display */
.mileage-hero-card {
    background: linear-gradient(135deg, rgba(var(--accent-indigo-rgb), 0.04) 0%, rgba(var(--accent-indigo-rgb), 0.01) 100%);
    border: 1px solid rgba(var(--accent-indigo-rgb), 0.15);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(var(--accent-indigo-rgb), 0.02);
}

.mileage-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    font-weight: 600;
}

.mileage-value-container {
    margin: 8px 0;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.mileage-val {
    font-family: var(--font-heading);
    font-size: 38px;
    font-weight: 900;
    color: var(--accent-indigo);
    letter-spacing: -1px;
}

.mileage-unit {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.mileage-sub {
    font-size: 10px;
    color: var(--text-muted);
}

/* Section Title */
.section-title {
    margin-top: 8px;
}

.section-title h2 {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Stats dashboard */
.status-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.status-metric-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 2px;
}

.metric-value-large {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.metric-unit {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Address detail card */
.address-container-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.address-details {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.4;
}

.address-details i {
    color: var(--accent-indigo);
    margin-top: 3px;
    font-size: 14px;
}

.last-ping-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    padding-top: 8px;
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
}

/* Privacy Mode overlay */
.privacy-active-banner {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--accent-red);
}

.privacy-active-banner i {
    font-size: 20px;
    margin-top: 2px;
}

.privacy-active-banner h4 {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 2px;
}

.privacy-active-banner p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--panel-border);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 11px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.action-btn:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--accent-indigo);
    color: var(--accent-indigo);
}

.action-btn i.loading {
    animation: fa-spin 1s infinite linear;
}

/* ==========================================================================
   Map Popup Style (Light Mode Override)
   ========================================================================== */

.map-popup-card {
    min-width: 200px;
}

.map-popup-card h4 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding-bottom: 4px;
    color: var(--text-primary);
}

.popup-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
}

.popup-row {
    display: flex;
    justify-content: space-between;
}

.popup-label {
    color: var(--text-secondary);
}

.popup-value {
    font-weight: 600;
    color: var(--text-primary);
}

.popup-value.moving { color: var(--accent-green); }
.popup-value.parked { color: var(--accent-orange); }

/* ==========================================================================
   Modals & Admin panel controls
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.3); /* Slate dark tint */
    backdrop-filter: blur(8px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #fff;
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    width: 90%;
    max-width: 440px;
    box-shadow: var(--shadow-large);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--accent-red);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--panel-border);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
}

.modal-footer button {
    padding: 10px 20px;
}

/* Admin controls styled form */
.styled-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 10px;
    outline: none;
    font-size: 14px;
    transition: var(--transition-fast);
}

.styled-input:focus {
    border-color: var(--accent-indigo);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 3px rgba(var(--accent-indigo-rgb), 0.1);
}

.admin-controls-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-controls-grid.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.admin-controls-grid label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 700;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.admin-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: #f8fafc;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.admin-btn:hover {
    background: #fff;
}

.admin-btn.active {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.btn-start.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.btn-stop.active {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border-color: var(--accent-red);
}

.btn-hide.active {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
    border-color: var(--accent-orange);
}

.btn-show.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent-indigo);
    border-color: var(--accent-indigo);
}

.btn-reset {
    background: #fff;
    color: var(--text-secondary);
}
.btn-reset:hover {
    background: #f8fafc;
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* ==========================================================================
   Toast Alerts (Popup notifications)
   ========================================================================== */

.toast-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    padding: 14px 20px;
    border-radius: 14px;
    box-shadow: var(--shadow-large);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    min-width: 280px;
    transform: translateY(-20px);
    opacity: 0;
    animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast i { font-size: 18px; }
.toast-success i { color: var(--accent-green); }
.toast-error i { color: var(--accent-red); }
.toast-info i { color: var(--accent-indigo); }
.toast-warning i { color: var(--accent-orange); }

.toast-content {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

/* ==========================================================================
   Custom Vehicle Marker
   ========================================================================== */

.vehicle-marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-pulse-wrapper {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-halo {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(var(--accent-indigo-rgb), 0.15);
    animation: markerPulse 2.5s infinite ease-out;
}

.marker-halo:not(.parked) {
    animation-duration: 1.2s; /* Faster live radar pulsing when driving */
}

.marker-halo.parked {
    background: rgba(245, 158, 11, 0.15);
}

.marker-center {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--accent-indigo);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 2;
    /* Limit transition to styles, NOT transform/position properties, to avoid Leaflet positioning conflicts */
    transition: border-color 0.15s ease, background-color 0.15s ease;
    overflow: hidden;
    /* Hardware acceleration rendering context to prevent zoom blurriness */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translate3d(0,0,0);
}

.marker-center:not(.parked) {
    animation: drivingBounce 0.45s infinite linear; /* Bounces/shakes to show vehicle is driving */
}

/* Disable keyframe animations temporarily during active map zoom transitions */
/* This solves browser transform compositing issues where markers clip or disappear */
.leaflet-zoom-anim .marker-center,
.leaflet-zoom-anim .marker-halo {
    animation: none !important;
    transition: none !important;
}

.marker-center.parked {
    border-color: var(--accent-orange);
}

@keyframes drivingBounce {
    0% { transform: translateY(0) rotate(0); }
    25% { transform: translateY(-1px) rotate(-1deg); }
    50% { transform: translateY(0) rotate(0); }
    75% { transform: translateY(-1px) rotate(1deg); }
    100% { transform: translateY(0) rotate(0); }
}

.marker-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.marker-direction-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid var(--accent-indigo);
    top: -4px;
    left: calc(50% - 6px);
    z-index: 1;
}

.marker-direction-arrow.parked {
    border-bottom-color: var(--accent-orange);
}

/* ==========================================================================
   Animations & Transitions
   ========================================================================== */

@keyframes statusPulse {
    0% { transform: scale(0.95); opacity: 0.5; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.0); }
    100% { transform: scale(0.95); opacity: 0.5; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes toastIn {
    to { transform: translateY(0); opacity: 1; }
}

@keyframes markerPulse {
    0% { transform: scale(0.3); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 0; }
}

/* ==========================================================================
   Mobile Responsive Adjustments
   ========================================================================== */

@media (max-width: 500px) {
    .sidebar {
        top: auto;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 44vh;
        border-radius: 20px 20px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        box-shadow: 0 -10px 30px rgba(0,0,0,0.08);
    }
    
    .sidebar.collapsed {
        transform: translateY(100%) translateY(-60px);
    }
    
    .sidebar-toggle-btn {
        right: 20px;
        top: -30px;
        width: 56px;
        height: 30px;
        border-radius: 10px 10px 0 0;
        border-bottom: none;
        border-right: 1px solid var(--panel-border);
        border-left: 1px solid var(--panel-border);
        transform: none;
    }
    
    .sidebar.collapsed .sidebar-toggle-btn i {
        transform: rotate(90deg);
    }
    
    .sidebar-toggle-btn i {
        transform: rotate(-90deg);
    }
    
    .app-header {
        padding: 10px 16px;
        border-bottom: 1px solid var(--panel-border);
    }
    
    .app-header h1 {
        font-size: 18px;
    }
    
    .app-header .subtitle {
        font-size: 10px;
    }
    
    .vehicles-section {
        padding: 12px 16px;
        gap: 10px;
    }
    
    .section-title {
        margin-bottom: 4px;
    }
    
    .section-title h2 {
        font-size: 11px;
    }
    
    /* Compact mileage hero */
    .mileage-hero-card {
        padding: 12px 16px;
        border-radius: 16px;
    }
    
    .mileage-label {
        font-size: 9px;
        margin-bottom: 2px;
    }
    
    .mileage-value-container {
        gap: 4px;
    }
    
    .mileage-val {
        font-size: 26px;
    }
    
    .mileage-unit {
        font-size: 12px;
    }
    
    .mileage-sub {
        font-size: 8px;
        margin-top: 2px;
    }
    
    /* 4-column metric row on mobile */
    .status-cards-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px;
    }
    
    .status-metric-card {
        padding: 6px 4px;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .metric-label {
        font-size: 8px;
        margin-bottom: 2px;
    }
    
    .metric-value-large {
        font-size: 13px !important;
        line-height: 1.2 !important;
    }
    
    .metric-unit {
        font-size: 8px;
    }
    
    /* Compact location and flag details */
    .address-container-card {
        padding: 8px 12px;
        border-radius: 12px;
    }
    
    .country-flags-list {
        font-size: 20px !important;
        padding: 2px 0 !important;
    }
    
    .address-details {
        font-size: 12px;
        gap: 6px;
    }
    
    .last-ping-footer {
        font-size: 9px;
        margin-top: 4px;
    }
    
    /* Compact YouTube subscribe button */
    .youtube-sidebar-card {
        margin-top: 4px;
    }
    
    .youtube-sidebar-btn {
        padding: 10px 12px;
        font-size: 12px;
        border-radius: 12px;
    }
    
    /* Compact splash wait/completed covers */
    .splash-card {
        width: 90% !important;
        padding: 24px 16px !important;
        border-radius: 20px !important;
        gap: 12px !important;
    }
    
    .splash-card h1 {
        font-size: 22px !important;
    }
    
    .splash-card p {
        font-size: 12px !important;
    }
    
    .channel-logo.avatar-logo {
        width: 80px !important;
        height: 80px !important;
        margin-bottom: 8px !important;
    }
    
    .final-stats-grid {
        gap: 6px !important;
        margin-bottom: 10px !important;
    }
    
    .final-stat-card {
        padding: 8px 6px !important;
        border-radius: 12px !important;
    }
    
    .final-stat-label {
        font-size: 9px !important;
    }
    
    .final-stat-val {
        font-size: 18px !important;
    }
    
    .final-stat-unit {
        font-size: 10px !important;
    }
    
    .final-countries-container {
        padding: 8px 12px !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
    }
    
    /* Hide Leaflet zoom controls on mobile for a clean canvas */
    .leaflet-control-zoom {
        display: none !important;
    }
}

/* Custom Avatar Logo for Waiting Splash Screen */
.channel-logo.avatar-logo {
    width: 110px;
    height: 110px;
    background: none;
    border: none;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    margin-bottom: 16px;
}

.splash-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--accent-indigo);
}

/* YouTube Subscription Sidebar Card styling */
.youtube-sidebar-card {
    margin-top: 16px;
    width: 100%;
}

.youtube-sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    border-radius: 16px;
    background: #ff0000; /* YouTube Red */
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.2);
    transition: all 0.2s ease-in-out;
}

.youtube-sidebar-btn:hover {
    background: #e60000;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 0, 0, 0.3);
}

.youtube-sidebar-btn i {
    font-size: 18px;
}

/* ==========================================================================
   Live Travel Updates Timeline Feed
   ========================================================================== */
.updates-timeline {
    position: relative;
    padding-left: 20px;
    margin-left: 10px;
    border-left: 2px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 10px;
    padding-bottom: 10px;
}

.timeline-item {
    position: relative;
}

/* Timeline dot */
.timeline-item::before {
    content: '';
    position: absolute;
    left: -27px; /* Align precisely on the line: 20px padding + 10px margin - 3px half width */
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-indigo);
    border: 3px solid var(--panel-bg);
    box-shadow: 0 0 0 2px rgba(var(--accent-indigo-rgb), 0.15);
    z-index: 2;
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.timeline-time {
    font-weight: 700;
    color: var(--accent-indigo);
}

.timeline-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 14px;
    box-shadow: var(--shadow-small);
    transition: all 0.25s ease-in-out;
    text-align: left;
}

.timeline-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.timeline-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0;
    word-break: break-word;
}

.timeline-img-container {
    width: 100%;
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    max-height: 200px;
}

.timeline-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Tab contents toggling */
.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
}

/* Media Query Overrides for Timeline on Mobile */
@media (max-width: 500px) {
    .updates-timeline {
        padding-left: 16px;
        margin-left: 6px;
        gap: 14px;
    }
    
    .timeline-item::before {
        left: -22px;
        width: 10px;
        height: 10px;
        border-width: 2px;
    }
    
    .timeline-card {
        padding: 10px 12px;
        border-radius: 12px;
    }
    
    .timeline-text {
        font-size: 12px;
    }
    
    .timeline-img-container {
        max-height: 140px;
        margin-top: 8px;
    }
}
