/**
 * Navigation Mode CSS - Turn-by-Turn Navigation UI
 *
 * Automotive HUD aesthetic — inspired by Mercedes MBUX / Porsche instrument clusters
 * Dark chrome bars, high-contrast tabular numerics, green accent glow
 * Uses existing --ios-* variables from navigator.css
 */

/* === Navigation Mode Overlay === */
.nav-mode-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    flex-direction: column;
    background: transparent;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.nav-mode-overlay.visible {
    opacity: 1;
    pointer-events: none;
}

/* Only interactive children receive clicks */
.nav-mode-overlay .nav-mode-top-bar,
.nav-mode-overlay .nav-mode-bottom-bar,
.nav-mode-overlay .nav-recenter-btn,
.nav-mode-overlay .nav-warning,
.nav-mode-overlay .nav-mode-speed-limit,
.nav-mode-overlay .nav-mode-driver-actions,
.nav-mode-overlay .nav-rerouting-overlay,
.nav-mode-overlay .nav-arrival-overlay,
.nav-mode-overlay .nav-incident-banner,
.nav-mode-overlay .nav-weather-change-banner {
    pointer-events: auto;
}

/* Hide other UI elements during navigation */
.nav-mode-hidden {
    display: none !important;
}

/* ================================================
   TOP BAR — Turn Instruction (HUD Style)
   ================================================ */
.nav-mode-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(16, 42, 28, 0.96) 0%, rgba(20, 52, 35, 0.94) 100%);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
    color: white;
    padding: var(--safe-top, 0) clamp(12px, 3vw, 20px) clamp(8px, 2vh, 14px);
    padding-top: calc(var(--safe-top, 0px) + clamp(8px, 2vh, 14px));
    display: flex;
    align-items: center;
    gap: clamp(10px, 2.5vw, 16px);
    z-index: 10;
    /* Green accent strip at bottom */
    border-bottom: 2.5px solid rgba(52, 199, 89, 0.7);
    box-shadow:
        0 1px 0 rgba(52, 199, 89, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.4);
}

.nav-turn-icon {
    width: clamp(44px, 9vh, 60px);
    height: clamp(44px, 9vh, 60px);
    background: rgba(52, 199, 89, 0.18);
    border: 1.5px solid rgba(52, 199, 89, 0.35);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Turn icon zoom when approaching turn */
.nav-turn-icon.turn-near {
    transform: scale(1.1);
    background: rgba(52, 199, 89, 0.28);
    border-color: rgba(52, 199, 89, 0.5);
    box-shadow: 0 0 20px rgba(52, 199, 89, 0.2);
}
.nav-turn-icon.turn-imminent {
    transform: scale(1.25);
    background: rgba(52, 199, 89, 0.38);
    border-color: rgba(52, 199, 89, 0.7);
    box-shadow: 0 0 28px rgba(52, 199, 89, 0.35);
}

.nav-turn-icon i {
    font-size: clamp(22px, 4.5vh, 30px);
    color: #5AE67C;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.nav-turn-icon svg {
    width: clamp(22px, 4.5vh, 30px);
    height: clamp(22px, 4.5vh, 30px);
    color: #5AE67C;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.nav-turn-info {
    flex: 1;
    min-width: 0;
}

.nav-turn-distance {
    font-size: clamp(26px, 5.5vh, 38px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.nav-turn-instruction {
    font-size: clamp(13px, 2.4vh, 17px);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.88);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.2px;
}

.nav-next-street {
    font-size: clamp(11px, 1.8vh, 14px);
    color: rgba(255, 255, 255, 0.55);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.1px;
}

/* ================================================
   BOTTOM BAR — Dashboard (Instrument Cluster Style)
   ================================================ */
.nav-mode-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(18, 18, 22, 0.97) 0%, rgba(24, 24, 30, 0.95) 100%);
    -webkit-backdrop-filter: saturate(200%) blur(28px);
    backdrop-filter: saturate(200%) blur(28px);
    padding: clamp(6px, 1.5vh, 14px) clamp(12px, 3vw, 20px);
    padding-bottom: calc(var(--safe-bottom, 0px) + clamp(6px, 1.5vh, 10px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(8px, 2vw, 16px);
    /* Subtle top edge highlight */
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* Speed Display — The Hero Element */
.nav-current-speed {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: clamp(56px, 12vw, 88px);
    position: relative;
    padding: 4px 0;
}

/* Subtle circular gauge ring behind speed */
.nav-current-speed::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    border: 1.5px solid rgba(52, 199, 89, 0.2);
    pointer-events: none;
}

.nav-speed-value {
    font-size: clamp(28px, 6vh, 48px);
    font-weight: 800;
    line-height: 1;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    text-shadow: 0 0 20px rgba(52, 199, 89, 0.15);
}

.nav-speed-unit {
    font-size: clamp(9px, 1.4vh, 11px);
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1.5px;
    margin-top: 1px;
}

/* Route Progress — ETA & Remaining */
.nav-route-progress {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
}

.nav-eta-time {
    font-size: clamp(16px, 3.2vh, 24px);
    font-weight: 700;
    color: #fff;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.nav-remaining-info {
    display: flex;
    gap: 4px;
    font-size: clamp(10px, 1.8vh, 13px);
    color: rgba(255, 255, 255, 0.45);
    align-items: baseline;
    font-variant-numeric: tabular-nums;
}

.nav-remaining-distance,
.nav-remaining-time {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
}

.nav-eta-time::after {
    content: '·';
    margin-left: 6px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.25);
}

/* Progress Bar — Thin green glow */
.nav-progress-container {
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
}

.nav-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #34C759 0%, #5AE67C 100%);
    box-shadow: 0 0 12px rgba(52, 199, 89, 0.5);
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    width: 0%;
}

/* Control Buttons — Frosted glass pills */
.nav-mode-controls {
    display: flex;
    gap: clamp(4px, 1vw, 8px);
}

.nav-mode-btn {
    width: clamp(36px, 6.5vh, 46px);
    height: clamp(36px, 6.5vh, 46px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: clamp(14px, 2.5vh, 17px);
    color: rgba(255, 255, 255, 0.6);
}

.nav-mode-btn:active {
    transform: scale(0.88);
    background: rgba(255, 255, 255, 0.15);
}

.nav-gps-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
}

.nav-gps-toggle-btn.active {
    background: rgba(0, 122, 255, 0.25);
    border-color: rgba(0, 122, 255, 0.4);
    color: #64B5F6;
    box-shadow: 0 0 12px rgba(0, 122, 255, 0.15);
}

.nav-gps-toggle-btn.active i {
    animation: nav-gps-pulse 2.5s ease-in-out infinite;
}

@keyframes nav-gps-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.nav-voice-btn {
    background: rgba(255, 255, 255, 0.06);
    color: #64B5F6;
}

.nav-voice-btn.alerts-only {
    color: #FFB74D;
    background: rgba(255, 152, 0, 0.12);
    border-color: rgba(255, 152, 0, 0.25);
}

.nav-voice-btn.muted {
    color: rgba(255, 255, 255, 0.3);
}

.nav-exit-btn {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.35);
    color: #FF6B6B;
    font-size: 14px;
    font-weight: 600;
    border-radius: 13px;
}

/* Exit button is icon-only everywhere */
.nav-exit-btn span {
    display: none;
}

.nav-exit-btn:active {
    background: rgba(255, 59, 48, 0.4);
}

.nav-exit-btn i {
    font-size: 14px;
}

/* ================================================
   WARNINGS — Floating Chips
   ================================================ */
.nav-warning {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 149, 0, 0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 20px rgba(255, 149, 0, 0.35);
    z-index: 15;
    letter-spacing: 0.2px;
}

.nav-warning i {
    font-size: 15px;
}

.nav-accuracy-warning {
    background: rgba(255, 149, 0, 0.92);
}

.nav-off-route-warning {
    background: rgba(255, 59, 48, 0.92);
    box-shadow: 0 4px 20px rgba(255, 59, 48, 0.35);
}

/* ================================================
   REROUTING OVERLAY
   ================================================ */
.nav-rerouting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.nav-rerouting-content {
    background: rgba(30, 30, 36, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 32px 40px;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.nav-rerouting-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #5AE67C;
    border-radius: 50%;
    animation: nav-spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.nav-rerouting-text {
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.3px;
}

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

/* === User Location Marker === */
.nav-mode-user-marker {
    background: none;
    border: none;
}

.nav-user-arrow {
    width: 40px;
    height: 40px;
    position: relative;
}

.nav-user-arrow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 28px solid #3B82F6;
    filter: drop-shadow(0 2px 6px rgba(59, 130, 246, 0.5));
}

.nav-user-arrow::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    border: 3px solid #3B82F6;
}

/* === Toast Messages === */
.nav-mode-toast {
    position: fixed;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 26, 0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    animation: nav-toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1), nav-toast-out 0.3s ease 2.7s forwards;
}

@keyframes nav-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes nav-toast-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* === Hide map controls & POI bar during navigation mode === */
.nav-mode-overlay.visible ~ .nav-map-controls,
.nav-mode-overlay.visible ~ .nav-left-controls,
.nav-mode-overlay.visible ~ .nav-poi-bar,
.nav-mode-overlay.visible ~ .nav-weather-strip {
    display: none !important;
}

/* Safety: also hide via state class (belt-and-suspenders with nav-mode-hidden) */
.nav-state-navigating .nav-left-controls,
.nav-state-navigating .nav-map-controls,
.nav-state-navigating .nav-poi-bar {
    display: none !important;
}

/* ================================================
   MOBILE PORTRAIT — Fixed bars, compact exit
   ================================================ */
@media (max-width: 768px) {
    .nav-mode-top-bar {
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 2010;
    }

    .nav-turn-instruction {
        white-space: normal;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .nav-mode-bottom-bar {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 2010;
    }

    .nav-exit-btn {
        width: clamp(34px, 5.5vh, 40px);
        height: clamp(34px, 5.5vh, 40px);
        padding: 0;
        border-radius: 13px;
        font-size: clamp(14px, 2.2vh, 16px);
    }

    .nav-warning {
        position: fixed;
        top: 100px;
        z-index: 2015;
        font-size: 12px;
        padding: 6px 14px;
    }

    .nav-mode-speed-limit {
        bottom: 100px;
    }

    .nav-mode-speed-limit-sign {
        width: clamp(38px, 6.5vh, 46px);
        height: clamp(38px, 6.5vh, 46px);
        border-width: 3px;
    }

    .nav-mode-speed-limit-value {
        font-size: clamp(15px, 2.5vh, 19px);
    }

    .nav-recenter-btn {
        bottom: 110px;
        width: clamp(38px, 5.5vh, 42px);
        height: clamp(38px, 5.5vh, 42px);
        font-size: clamp(16px, 2.5vh, 18px);
    }
}

/* Short screens: compact street name to save space */
@media (max-height: 600px) {
    .nav-next-street {
        font-size: 10px;
        margin-top: 1px;
    }
}

/* ================================================
   NIGHT MODE — Amber & Teal on Deep Black
   (True automotive night mode, not just darker green)
   ================================================ */
.nav-mode-overlay.night-mode .nav-mode-top-bar {
    background: linear-gradient(180deg, rgba(8, 8, 12, 0.97) 0%, rgba(12, 12, 18, 0.95) 100%);
    border-bottom-color: rgba(255, 183, 77, 0.5);
    box-shadow:
        0 1px 0 rgba(255, 183, 77, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.6);
}

.nav-mode-overlay.night-mode .nav-turn-icon {
    background: rgba(255, 183, 77, 0.12);
    border-color: rgba(255, 183, 77, 0.25);
}

.nav-mode-overlay.night-mode .nav-turn-icon i,
.nav-mode-overlay.night-mode .nav-turn-icon svg {
    color: #FFB74D;
    filter: drop-shadow(0 0 6px rgba(255, 183, 77, 0.3));
}

.nav-mode-overlay.night-mode .nav-turn-icon.turn-near {
    background: rgba(255, 183, 77, 0.2);
    border-color: rgba(255, 183, 77, 0.4);
    box-shadow: 0 0 20px rgba(255, 183, 77, 0.15);
}

.nav-mode-overlay.night-mode .nav-turn-icon.turn-imminent {
    background: rgba(255, 183, 77, 0.3);
    border-color: rgba(255, 183, 77, 0.6);
    box-shadow: 0 0 28px rgba(255, 183, 77, 0.3);
}

.nav-mode-overlay.night-mode .nav-turn-distance {
    color: #FFD699;
    text-shadow: 0 0 16px rgba(255, 183, 77, 0.15);
}

.nav-mode-overlay.night-mode .nav-mode-bottom-bar {
    background: rgba(6, 6, 10, 0.97);
    border-top-color: rgba(255, 255, 255, 0.04);
}

.nav-mode-overlay.night-mode .nav-speed-value {
    color: #E0E0E0;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.08);
}

.nav-mode-overlay.night-mode .nav-eta-time {
    color: #E0E0E0;
}

.nav-mode-overlay.night-mode .nav-remaining-info {
    color: rgba(255, 255, 255, 0.3);
}

.nav-mode-overlay.night-mode .nav-remaining-distance,
.nav-mode-overlay.night-mode .nav-remaining-time {
    color: rgba(255, 255, 255, 0.4);
}

.nav-mode-overlay.night-mode .nav-current-speed::before {
    border-color: rgba(255, 183, 77, 0.12);
}

.nav-mode-overlay.night-mode .nav-progress-bar {
    background: linear-gradient(90deg, #FFB74D 0%, #FFD699 100%);
    box-shadow: 0 0 12px rgba(255, 183, 77, 0.4);
}

.nav-mode-overlay.night-mode .nav-mode-btn {
    border-color: rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.04);
}

.nav-mode-overlay.night-mode .nav-gps-toggle-btn.active {
    background: rgba(100, 181, 246, 0.15);
    border-color: rgba(100, 181, 246, 0.25);
}

/* ================================================
   LANDSCAPE MOBILE — Ultra-compact single-line bars
   Maximum map real estate for driving
   ================================================ */
.nav-mobile.nav-landscape .nav-mode-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2010;
    padding: 2px 12px 3px;
    padding-left: calc(var(--safe-left, 0px) + 12px);
    padding-right: calc(var(--safe-right, 0px) + 12px);
    /* Reset tablet/desktop centering */
    transform: none;
    max-width: none;
    border-radius: 0;
    /* Ultra-slim top bar */
    gap: 10px;
    border-bottom-width: 2px;
}

/* Compact turn icon in landscape */
.nav-mobile.nav-landscape .nav-turn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border-width: 1px;
}

.nav-mobile.nav-landscape .nav-turn-icon i,
.nav-mobile.nav-landscape .nav-turn-icon svg {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Distance and instruction on one line */
.nav-mobile.nav-landscape .nav-turn-info {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.nav-mobile.nav-landscape .nav-turn-distance {
    font-size: 22px;
    flex-shrink: 0;
}

.nav-mobile.nav-landscape .nav-turn-instruction {
    font-size: 13px;
    margin-top: 0;
    opacity: 0.8;
}

.nav-mobile.nav-landscape .nav-next-street {
    display: none;
}

/* Ultra-slim bottom bar */
.nav-mobile.nav-landscape .nav-mode-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2010;
    padding: 3px 12px;
    padding-left: calc(var(--safe-left, 0px) + 12px);
    padding-right: calc(var(--safe-right, 0px) + 12px);
    padding-bottom: calc(var(--safe-bottom, 0px) + 3px);
    transform: none;
    max-width: none;
    border-radius: 0;
    gap: 10px;
}

/* Compact speed in landscape */
.nav-mobile.nav-landscape .nav-current-speed {
    flex-direction: row;
    align-items: baseline;
    gap: 3px;
    min-width: auto;
    padding: 0;
}

.nav-mobile.nav-landscape .nav-current-speed::before {
    display: none;
}

.nav-mobile.nav-landscape .nav-speed-value {
    font-size: 24px;
}

.nav-mobile.nav-landscape .nav-speed-unit {
    font-size: 9px;
    margin-top: 0;
}

/* Compact ETA */
.nav-mobile.nav-landscape .nav-eta-time {
    font-size: 15px;
}

.nav-mobile.nav-landscape .nav-remaining-info {
    font-size: 10px;
}

/* Compact control buttons */
.nav-mobile.nav-landscape .nav-mode-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 13px;
}

.nav-mobile.nav-landscape .nav-exit-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 10px;
    font-size: 13px;
}

/* Progress bar: thinner in landscape */
.nav-mobile.nav-landscape .nav-progress-container {
    height: 2px;
    top: -2px;
}

/* Repositioned elements for landscape */
.nav-mobile.nav-landscape .nav-recenter-btn {
    right: calc(var(--safe-right, 0px) + 14px);
    bottom: 50%;
    transform: translateY(50%);
    width: 36px;
    height: 36px;
    font-size: 16px;
    border-radius: 11px;
    background: rgba(20, 20, 26, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #64B5F6;
}

.nav-mobile.nav-landscape .nav-mode-speed-limit {
    left: auto;
    right: calc(var(--safe-right, 0px) + 14px);
    bottom: calc(50% + 30px);
}

.nav-mobile.nav-landscape .nav-mode-speed-limit-sign {
    width: 36px;
    height: 36px;
    border-width: 2.5px;
}

.nav-mobile.nav-landscape .nav-mode-speed-limit-value {
    font-size: 15px;
}

/* Driver actions — horizontal row in landscape */
.nav-mobile.nav-landscape .nav-mode-driver-actions {
    right: auto;
    left: calc(var(--safe-left, 0px) + 14px);
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 6px;
}

.nav-mobile.nav-landscape .nav-mode-driver-actions .nav-mode-action-btn {
    width: 36px;
    height: 36px;
    font-size: 15px;
}

/* Warning chips in landscape */
.nav-mobile.nav-landscape .nav-warning {
    top: auto;
    bottom: calc(var(--safe-bottom, 0px) + 56px);
    font-size: 11px;
    padding: 5px 12px;
}

/* ================================================
   MOBILE PORTRAIT — Compact bottom bar to prevent
   speed from overlapping arrival time
   ================================================ */
.nav-mobile.nav-portrait .nav-mode-bottom-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 2010;
    gap: 10px;
    padding: 8px 12px;
    padding-bottom: calc(var(--safe-bottom, 0px) + 6px);
}

.nav-mobile.nav-portrait .nav-current-speed {
    min-width: auto;
    padding: 2px 0;
    flex-shrink: 0;
}

.nav-mobile.nav-portrait .nav-current-speed::before {
    inset: -1px;
    border-radius: 12px;
}

.nav-mobile.nav-portrait .nav-speed-value {
    font-size: clamp(22px, 4.5vh, 34px);
}

.nav-mobile.nav-portrait .nav-speed-unit {
    font-size: 9px;
}

.nav-mobile.nav-portrait .nav-route-progress {
    flex: 1;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.nav-mobile.nav-portrait .nav-eta-time {
    font-size: clamp(16px, 3vh, 22px);
}

.nav-mobile.nav-portrait .nav-eta-time::after {
    display: none;
}

.nav-mobile.nav-portrait .nav-remaining-info {
    font-size: clamp(10px, 1.6vh, 12px);
}

.nav-mobile.nav-portrait .nav-mode-btn {
    width: clamp(32px, 5vh, 40px);
    height: clamp(32px, 5vh, 40px);
    border-radius: 11px;
    font-size: clamp(13px, 2vh, 15px);
}

.nav-mobile.nav-portrait .nav-exit-btn {
    width: clamp(32px, 5vh, 40px);
    height: clamp(32px, 5vh, 40px);
    padding: 0;
    border-radius: 11px;
    font-size: clamp(13px, 2vh, 15px);
}

/* ================================================
   TABLET/DESKTOP — Centered floating bars
   ================================================ */
@media (min-width: 769px) {
    .nav-mode-top-bar {
        left: 50%;
        transform: translateX(-50%);
        max-width: 520px;
        border-radius: 0 0 16px 16px;
        top: 0;
    }

    .nav-mode-bottom-bar {
        left: 50%;
        transform: translateX(-50%);
        max-width: 520px;
        border-radius: 16px 16px 0 0;
        bottom: 0;
    }

    .nav-turn-distance {
        font-size: 42px;
    }

    .nav-turn-instruction {
        font-size: 19px;
    }
}

/* ================================================
   DARK THEME (non-night-mode)
   ================================================ */
[data-theme="dark"] .nav-mode-top-bar {
    background: linear-gradient(180deg, rgba(10, 30, 20, 0.97) 0%, rgba(14, 38, 26, 0.95) 100%);
}

[data-theme="dark"] .nav-mode-bottom-bar {
    background: rgba(14, 14, 18, 0.97);
}

[data-theme="dark"] .nav-rerouting-content {
    background: rgba(24, 24, 30, 0.95);
}

/* ================================================
   START NAVIGATION BUTTON
   ================================================ */
.nav-start-navigation-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 50%, #219A52 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    margin-top: 8px;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 16px rgba(46, 204, 113, 0.3);
}

.nav-start-navigation-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(46, 204, 113, 0.4);
}

.nav-start-navigation-btn:active {
    transform: scale(0.98) translateY(0);
}

.nav-start-navigation-btn i {
    font-size: 18px;
}

.nav-start-navigation-btn:disabled {
    background: var(--ios-gray3);
    box-shadow: none;
    cursor: not-allowed;
}

/* Pulse animation for Start Navigation button */
.nav-start-navigation-btn.ready {
    animation: nav-btn-pulse 2.5s ease-in-out infinite;
}

@keyframes nav-btn-pulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(46, 204, 113, 0.3); }
    50% { box-shadow: 0 4px 16px rgba(46, 204, 113, 0.3), 0 0 0 8px rgba(46, 204, 113, 0); }
}

/* ================================================
   GPS ACCURACY INDICATOR
   ================================================ */
.nav-gps-indicator {
    position: absolute;
    top: 130px;
    right: 16px;
    background: rgba(20, 20, 26, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    font-variant-numeric: tabular-nums;
}

.nav-gps-indicator i {
    color: #5AE67C;
}

.nav-gps-indicator.poor i {
    color: #FFB74D;
}

.nav-gps-indicator.bad i {
    color: #FF6B6B;
}

/* ================================================
   SPEED LIMIT SIGN (during navigation)
   ================================================ */
.nav-mode-speed-limit {
    position: absolute;
    bottom: 140px;
    left: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.nav-mode-speed-limit-sign {
    width: 52px;
    height: 52px;
    background: white;
    border: 4px solid #cc0000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.nav-mode-speed-limit-value {
    font-size: 22px;
    font-weight: 800;
    color: #000;
    font-variant-numeric: tabular-nums;
}

/* Speeding warning */
.nav-mode-speed-limit.speeding .nav-mode-speed-limit-sign {
    animation: speed-warning 0.6s ease infinite;
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.5);
}

@keyframes speed-warning {
    0%, 100% { background: white; }
    50% { background: #FFE0E0; }
}

/* ================================================
   ARRIVAL SCREEN
   ================================================ */
.nav-arrival-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 25;
}

.nav-arrival-content {
    background: rgba(24, 24, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 36px 48px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    max-width: 300px;
}

.nav-arrival-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #34C759 0%, #28A745 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 0 32px rgba(52, 199, 89, 0.3);
}

.nav-arrival-icon i {
    font-size: 32px;
    color: white;
}

.nav-arrival-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.nav-arrival-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 24px;
}

.nav-arrival-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.nav-arrival-btn:active {
    transform: scale(0.97);
}

/* === Animation for map rotation === */
#navigator-map {
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Enlarge to sqrt(2)=142% so rotation never shows grey corners */
.nav-mode-active #navigator-map {
    width: 142vw !important;
    height: 142vh !important;
    position: fixed !important;
    top: -21vh;
    left: -21vw;
}

/* ================================================
   RECENTER BUTTON
   ================================================ */
.nav-recenter-btn {
    position: absolute;
    bottom: 180px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(20, 20, 26, 0.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    color: #64B5F6;
    font-size: 18px;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-recenter-btn.visible {
    display: flex;
}

.nav-recenter-btn:active {
    transform: scale(0.88);
    background: rgba(20, 20, 26, 0.95);
}

/* === Very Small Screens (iPhone SE, small Android) === */
@media (max-width: 350px) {
    .nav-next-street {
        font-size: 10px;
    }
}

/* ================================================
   SPEED LIMIT SIGN (Bottom-Left, Fixed Position)
   ================================================ */
.nav-speed-limit-sign {
    position: fixed;
    bottom: calc(var(--safe-bottom, 0px) + 100px);
    left: calc(var(--safe-left, 0px) + 16px);
    z-index: 2005;
    background: white;
    border: 4px solid #d32f2f;
    border-radius: 50%;
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    transition: all 0.3s ease;
}

.nav-speed-limit-sign.warning {
    border-color: #ff9800;
    animation: pulse-warning 1.5s infinite;
}

.nav-speed-limit-sign.overspeed {
    border-color: #d32f2f;
    background: #fff3e0;
    animation: pulse-danger 1s infinite;
    box-shadow: 0 0 24px rgba(211, 47, 47, 0.4);
}

.nav-speed-limit-value {
    font-size: 26px;
    font-weight: 900;
    color: #000;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

@keyframes pulse-warning {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.04); opacity: 0.9; }
}

@keyframes pulse-danger {
    0%, 100% { transform: scale(1); border-color: #d32f2f; }
    50% { transform: scale(1.08); border-color: #ff5252; }
}

/* Responsive speed limit sign */
@media (max-width: 768px) {
    .nav-speed-limit-sign {
        width: 52px;
        height: 52px;
        bottom: calc(var(--safe-bottom, 0px) + 90px);
    }

    .nav-speed-limit-value {
        font-size: 23px;
    }
}

@media (max-width: 480px) {
    .nav-speed-limit-sign {
        width: 46px;
        height: 46px;
        bottom: calc(var(--safe-bottom, 0px) + 80px);
        border-width: 3px;
    }

    .nav-speed-limit-value {
        font-size: 20px;
    }
}

/* Night mode speed limit sign */
.nav-mode-overlay.night-mode .nav-speed-limit-sign {
    background: #1a1a1e;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.nav-mode-overlay.night-mode .nav-speed-limit-value {
    color: #E0E0E0;
}

/* === Print styles — hide navigation mode === */
@media print {
    .nav-mode-overlay, .nav-speed-limit-sign {
        display: none !important;
    }
}

/* ================================================
   LANE GUIDANCE — Google Maps Style
   ================================================ */

.nav-lane-guidance {
    position: fixed;
    bottom: calc(var(--safe-bottom, 0px) + 140px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 26, 0.94);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1100;
    min-width: 280px;
    max-width: 400px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-lane-guidance.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.nav-lane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
}

.nav-lane-distance {
    font-size: 17px;
    font-weight: 700;
    color: #64B5F6;
    font-variant-numeric: tabular-nums;
}

.nav-lane-exit {
    background: rgba(100, 181, 246, 0.2);
    color: #64B5F6;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid rgba(100, 181, 246, 0.25);
}

.nav-lane-arrows {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin: 8px 0;
}

.nav-lane {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 56px;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.nav-lane.recommended {
    background: rgba(52, 199, 89, 0.2);
    border-color: rgba(52, 199, 89, 0.4);
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(52, 199, 89, 0.2);
}

.nav-lane.active {
    background: rgba(100, 181, 246, 0.2);
    border-color: rgba(100, 181, 246, 0.4);
    animation: lanePulse 1.5s ease-in-out infinite;
}

@keyframes lanePulse {
    0%, 100% { transform: scale(1.05); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(100, 181, 246, 0.3); }
}

.nav-lane i {
    font-size: 22px;
    color: rgba(255, 255, 255, 0.4);
}

.nav-lane.recommended i {
    color: #5AE67C;
}

.nav-lane.active i {
    color: #64B5F6;
}

.nav-lane-multi-arrow {
    display: flex;
    gap: 2px;
}

.nav-lane-multi-arrow i {
    font-size: 16px;
}

.nav-lane-instruction {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 6px;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Lane guidance dark mode (already dark by default now) */
[data-theme="dark"] .nav-lane-guidance {
    background: rgba(14, 14, 18, 0.96);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .nav-lane {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .nav-lane i {
    color: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .nav-lane-distance {
    color: #64B5F6;
}

[data-theme="dark"] .nav-lane-instruction {
    color: rgba(255, 255, 255, 0.35);
}

/* Lane guidance responsive */
@media (max-width: 768px) {
    .nav-lane-guidance {
        bottom: calc(var(--safe-bottom, 0px) + 120px);
        min-width: 260px;
        padding: 10px 14px;
    }

    .nav-lane {
        width: 44px;
        height: 52px;
    }

    .nav-lane i {
        font-size: 20px;
    }

    .nav-lane-multi-arrow i {
        font-size: 15px;
    }

    .nav-lane-distance {
        font-size: 15px;
    }

    .nav-lane-exit {
        font-size: 11px;
        padding: 3px 8px;
    }

    .nav-lane-instruction {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .nav-lane-guidance {
        min-width: 240px;
        bottom: calc(var(--safe-bottom, 0px) + 110px);
    }

    .nav-lane {
        width: 40px;
        height: 48px;
    }

    .nav-lane i {
        font-size: 18px;
    }
}

/* Lane guidance landscape */
@media (max-height: 500px) and (orientation: landscape) {
    .nav-lane-guidance {
        bottom: calc(var(--safe-bottom, 0px) + 52px);
        padding: 8px 12px;
        min-width: 220px;
    }

    .nav-lane {
        width: 34px;
        height: 42px;
    }

    .nav-lane i {
        font-size: 15px;
    }

    .nav-lane-header {
        margin-bottom: 4px;
    }
}

/* Nearby Drivers button in navigation mode */
.nav-mode-drivers-btn {
    color: #5AE67C;
}

/* ================================================
   TABLET PORTRAIT — Full-width bars
   ================================================ */
.nav-mobile.nav-tablet .nav-mode-top-bar {
    transform: none;
    max-width: none;
    border-radius: 0;
    left: 0;
    right: 0;
}
.nav-mobile.nav-tablet .nav-mode-bottom-bar {
    transform: none;
    max-width: none;
    border-radius: 0;
    left: 0;
    right: 0;
}

/* ================================================
   TABLET LANDSCAPE — Bars on left, 1/3 width
   ================================================ */
.nav-mobile.nav-tablet.nav-landscape .nav-mode-top-bar {
    left: 0;
    right: auto;
    width: 33.33vw;
    min-width: 320px;
    max-width: 420px;
    border-radius: 0 0 16px 0;
    padding: var(--safe-top, 0) 16px 12px;
    padding-top: calc(var(--safe-top, 0px) + 12px);
    /* Restore multi-line for tablet */
    gap: 12px;
    border-bottom-width: 2.5px;
}

.nav-mobile.nav-tablet.nav-landscape .nav-turn-icon {
    width: clamp(44px, 9vh, 56px);
    height: clamp(44px, 9vh, 56px);
    border-radius: 14px;
}

.nav-mobile.nav-tablet.nav-landscape .nav-turn-info {
    display: block;
}

.nav-mobile.nav-tablet.nav-landscape .nav-turn-distance {
    font-size: clamp(24px, 5vh, 34px);
}

.nav-mobile.nav-tablet.nav-landscape .nav-turn-instruction {
    font-size: clamp(13px, 2.2vh, 16px);
    margin-top: 2px;
}

.nav-mobile.nav-tablet.nav-landscape .nav-next-street {
    display: block;
}

.nav-mobile.nav-tablet.nav-landscape .nav-mode-bottom-bar {
    left: 0;
    right: auto;
    width: 33.33vw;
    min-width: 320px;
    max-width: 420px;
    border-radius: 0 16px 0 0;
    padding: 12px 16px;
    padding-bottom: calc(var(--safe-bottom, 0px) + 12px);
}

.nav-mobile.nav-tablet.nav-landscape .nav-current-speed {
    flex-direction: column;
    min-width: clamp(56px, 12vw, 80px);
}

.nav-mobile.nav-tablet.nav-landscape .nav-current-speed::before {
    display: block;
}

.nav-mobile.nav-tablet.nav-landscape .nav-mode-speed-limit {
    left: auto;
    right: 20px;
    bottom: calc(50% + 50px);
}

.nav-mobile.nav-tablet.nav-landscape .nav-mode-driver-actions {
    right: 20px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
}

.nav-mobile.nav-tablet.nav-landscape .nav-recenter-btn {
    right: 20px;
    bottom: 50%;
    transform: translateY(50%);
    width: 44px;
    height: 44px;
}

/* ================================================
   RESTRICTION ZONE BUTTON
   ================================================ */
.nav-mode-restriction-btn {
    background: rgba(20, 20, 26, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #FFB74D;
    border: 1px solid rgba(255, 183, 77, 0.2);
    border-radius: 13px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: all 0.3s ease;
}

[data-theme="dark"] .nav-mode-restriction-btn {
    background: rgba(14, 14, 18, 0.9);
    color: #FFB74D;
}

.nav-mode-restriction-btn svg {
    width: 20px;
    height: 20px;
}

/* Danger state — near restriction zone */
.nav-mode-restriction-btn.zone-danger {
    background: rgba(255, 59, 48, 0.9);
    border-color: rgba(255, 59, 48, 0.6);
    color: #fff;
    animation: restriction-pulse 1s ease-in-out infinite;
}

[data-theme="dark"] .nav-mode-restriction-btn.zone-danger {
    background: rgba(255, 69, 58, 0.9);
    color: #fff;
}

@keyframes restriction-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3); }
    50% { transform: scale(1.08); box-shadow: 0 4px 20px rgba(255, 59, 48, 0.5); }
}

/* ================================================
   CAMERA ALERT BANNER
   ================================================ */
.nav-camera-alert-banner {
    position: absolute;
    top: calc(var(--safe-top, 0px) + 80px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(124, 58, 237, 0.92);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: #fff;
    border-radius: 18px;
    padding: 10px 18px;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 2010;
    box-shadow: 0 4px 24px rgba(124, 58, 237, 0.4);
    animation: cam-alert-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes cam-alert-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.cam-alert-limit-sign {
    width: 42px;
    height: 42px;
    border: 3px solid #cc0000;
    border-radius: 50%;
    background: #fff;
    color: #000;
    font-weight: 800;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.cam-alert-type {
    display: flex; align-items: center; gap: 4px;
    font-weight: 600; font-size: 14px;
}

.cam-alert-distance {
    font-size: 12px; opacity: 0.75;
    font-variant-numeric: tabular-nums;
}

/* Landscape: move banner to bottom to avoid top bar */
.nav-mobile.nav-landscape .nav-camera-alert-banner {
    top: auto;
    bottom: calc(var(--safe-bottom, 0px) + 52px);
    left: 50%;
    padding: 8px 14px;
    border-radius: 14px;
}

.nav-mobile.nav-landscape .cam-alert-limit-sign {
    width: 34px;
    height: 34px;
    font-size: 14px;
    border-width: 2.5px;
}

/* Tablet landscape: shift to avoid left bar */
.nav-mobile.nav-tablet.nav-landscape .nav-camera-alert-banner {
    left: calc(33.33vw + 50%);
    transform: translateX(-50%);
}
