/* Voyagr Navigation App - Main Stylesheet */
/* Extracted from HTML_TEMPLATE for better maintainability */
/* Enhanced for modern PWA mobile experience - 2024 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* iOS safe area support */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
}

html,
body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    overflow: hidden;
    /* Smooth scrolling */
    -webkit-overflow-scrolling: touch;
    /* Prevent text size adjustment on orientation change */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Prevent pull-to-refresh on Chrome Android */
    overscroll-behavior-y: contain;
}

body {
    display: flex;
    flex-direction: column;
    /* iOS safe area padding */
    padding-top: var(--safe-area-inset-top);
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
}

/* Full-screen map layout */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

/* Floating action buttons */
.fab-container {
    position: absolute;
    bottom: calc(100px + var(--safe-area-inset-bottom, 0px));
    right: calc(20px + var(--safe-area-inset-right, 0px));
    z-index: 150;
    /* z-index: 150 in mobile layout hierarchy */
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    /* GPU acceleration for smooth animations */
    will-change: transform;
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.fab:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Haptic feedback visual indicator */
.fab.haptic-feedback {
    animation: hapticPulse 0.15s ease;
}

@keyframes hapticPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.88);
    }

    100% {
        transform: scale(1);
    }
}

/* Bottom sheet drawer */
.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
    z-index: 50;
    height: 92vh;
    height: 92dvh;
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    transform: translateY(calc(100% - 110px - var(--safe-area-inset-bottom, 0px)));
    will-change: transform;
    padding-bottom: var(--safe-area-inset-bottom, 0px);
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: none;
}

.bottom-sheet.expanded {
    transform: translateY(0) !important;
    height: 92vh;
    height: 92dvh;
}

.bottom-sheet-content {
    /* CRITICAL: Use viewport height directly since flex isn't working */
    height: calc(92vh - 110px) !important;
    height: calc(92dvh - 110px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    padding-bottom: 100px;
    touch-action: pan-y;
    pointer-events: auto;
    box-sizing: border-box;
}

/* ALL elements inside bottom-sheet-content: no overflow, no height limits */
.bottom-sheet-content *,
.bottom-sheet-content div,
.bottom-sheet-content div[id$="Tab"],
.bottom-sheet-content .preferences-section {
    overflow: visible !important;
    max-height: none !important;
}

/* Specific elements that need their own scroll */
.bottom-sheet-content .instructions-list {
    overflow-y: auto !important;
    max-height: 300px !important;
}
.bottom-sheet-content .search-history-dropdown,
.bottom-sheet-content .autocomplete-dropdown {
    overflow-y: auto !important;
    max-height: 250px !important;
}

/* Remove top border/margin from first preferences-section in tabs */
#routePreviewTab > .preferences-section:first-child,
#settingsTab > .preferences-section:first-child,
#routeComparisonTab > .preferences-section:first-child,
#tripHistoryTab > .preferences-section:first-child,
#savedRoutesTab > .preferences-section:first-child,
#routeSharingTab > .preferences-section:first-child,
#routeAnalyticsTab > .preferences-section:first-child,
#dashcamTab > .preferences-section:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* Speed Camera Markers */
.camera-marker {
    z-index: 100 !important;
    transition: transform 0.2s ease;
}

.camera-marker>div {
    cursor: pointer !important;
    background: white !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.bottom-sheet-handle {
    width: 100%;
    height: 50px;
    background: transparent;
    border-radius: 2px;
    margin: 0;
    cursor: grab;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    justify-content: center;
    position: relative;
    z-index: 10;
    touch-action: none;
    pointer-events: auto;
}

.bottom-sheet-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

.bottom-sheet-handle:active {
    cursor: grabbing;
}

.bottom-sheet-header {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 5;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
    min-height: 60px;
}

.bottom-sheet-header h2 {
    font-size: 18px;
    color: #333;
    margin: 0;
    flex: 1;
}

.bottom-sheet-header button {
    pointer-events: auto;
    z-index: 10;
    flex-shrink: 0;
}

.bottom-sheet-content::-webkit-scrollbar {
    width: 6px;
}

.bottom-sheet-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.bottom-sheet-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.bottom-sheet-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

input,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: inherit;
}

input:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.location-input-group {
    position: relative;
    margin-bottom: 15px;
}

.location-input-group input {
    padding-right: 90px;
    /* Space for two buttons (40px each + gap) */
}

/* Container for location buttons - positioned to not block input touch area */
.location-btn-container {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
    pointer-events: none;
    /* Let touches pass through to input */
}

.location-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    color: #667eea;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    /* Re-enable touch on buttons themselves */
}

.location-btn:hover {
    color: #5568d3;
    background: #e8e8e8;
}

.location-btn:active {
    background: #ddd;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

button {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-calculate {
    background: #667eea;
    color: white;
    grid-column: 1 / -1;
    font-weight: 600;
    font-size: 16px;
    padding: 14px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.btn-calculate:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.btn-clear {
    background: #f0f0f0;
    color: #333;
}

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

/* Quick search buttons */
.quick-search {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.quick-search-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #333;
}

.quick-search-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.quick-search-btn-icon {
    font-size: 24px;
}

/* Trip info section */
.trip-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: none;
}

.trip-info.show {
    display: block;
}

.trip-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.trip-info-row:last-child {
    margin-bottom: 0;
}

.trip-info-label {
    color: #666;
    font-weight: 500;
}

.trip-info-value {
    color: #333;
    font-weight: 600;
}

/* Status messages */
.status {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    display: none;
}

.status.show {
    display: block;
}

.status.loading {
    background: #fff3cd;
    color: #856404;
}

.status.success {
    background: #d4edda;
    color: #155724;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
}

/* Preferences section */
.preferences-section {
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
}

.preferences-section h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preference-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.preference-label {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    padding: 0;
}

.toggle-switch.active {
    background: #667eea;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.3s;
}

.toggle-switch.active::after {
    left: 22px;
}

/* Voice control section */
.voice-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.voice-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.voice-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-voice {
    background: #ff6b6b;
    color: white;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-voice:hover {
    background: #ff5252;
}

.btn-voice.active {
    background: #51cf66;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.btn-voice-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px;
    border: 2px solid white;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-voice-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.voice-status {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 4px;
    margin-top: 10px;
    min-height: 18px;
    font-size: 12px;
}

/* Responsive design - Mobile First */
@media (max-width: 768px) {
    .bottom-sheet {
        border-radius: 16px 16px 0 0;
        /* iOS safe area for bottom sheet */
        padding-bottom: var(--safe-area-inset-bottom);
    }

    .bottom-sheet-content {
        padding: 15px;
        /* Enable smooth momentum scrolling on iOS */
        -webkit-overflow-scrolling: touch;
    }

    .quick-search {
        grid-template-columns: 1fr 1fr;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    /* Larger touch targets for accessibility (min 44px) */
    button,
    .btn,
    .fab,
    input,
    select,
    .toggle-btn {
        min-height: 44px;
        min-width: 44px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }
}

@media (max-width: 480px) {
    .fab-container {
        bottom: calc(90px + var(--safe-area-inset-bottom));
        right: calc(10px + var(--safe-area-inset-right));
    }

    .fab {
        width: 52px;
        height: 52px;
        font-size: 22px;
        /* Better touch feedback */
        transition: transform 0.1s ease, box-shadow 0.1s ease;
    }

    .fab:active {
        transform: scale(0.92);
    }

    .quick-search {
        grid-template-columns: 1fr;
    }

    .bottom-sheet-content {
        padding: 12px;
        padding-bottom: calc(12px + var(--safe-area-inset-bottom));
    }

    /* Better button spacing for touch */
    .button-group {
        gap: 12px;
    }

    .btn {
        padding: 14px 20px;
        font-size: 16px;
        border-radius: 12px;
    }
}

/* Standalone PWA mode adjustments */
@media (display-mode: standalone) {
    .app-container {
        padding-top: var(--safe-area-inset-top);
    }

    .bottom-sheet {
        padding-bottom: var(--safe-area-inset-bottom);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {

    .btn,
    .fab {
        border: 2px solid currentColor;
    }

    input,
    select,
    textarea {
        border-width: 2px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bottom-sheet {
        transition: none;
    }
}

h1 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    font-size: 28px;
}

/* Voice Control Styles */
.voice-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-top: 30px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.voice-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
}

.voice-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-voice {
    background: #ff6b6b;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-voice:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.btn-voice.active {
    background: #51cf66;
    animation: pulse 1s infinite;
}

.btn-voice-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px;
    border: 2px solid white;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-voice-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.voice-status {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    min-height: 20px;
    font-size: 14px;
}

.voice-transcript {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    min-height: 30px;
    font-size: 14px;
    font-style: italic;
}

.voice-commands {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
}

.voice-commands p {
    margin: 0 0 8px 0;
    font-weight: bold;
}

.voice-commands ul {
    margin: 0;
    padding-left: 20px;
}

.voice-commands li {
    margin: 4px 0;
}

.status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.status.loading {
    display: block;
    background: #fff3cd;
    color: #856404;
}

.status.success {
    display: block;
    background: #d4edda;
    color: #155724;
}

.status.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
}

.result {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    display: none;
}

.result.show {
    display: block;
}

.result-item {
    margin: 10px 0;
    font-size: 16px;
}

.result-label {
    font-weight: bold;
    color: #667eea;
}

/* Phase 2 Features Styles */
.search-history-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-history-dropdown.show {
    display: block;
}

.search-history-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.search-history-item:hover {
    background: #f8f9ff;
}

/* Autocomplete Dropdown Styles */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.autocomplete-item:hover {
    background: #f0f7ff;
}

.autocomplete-item-icon {
    font-size: 16px;
    min-width: 20px;
}

.autocomplete-item-text {
    flex: 1;
    min-width: 0;
}

.autocomplete-item-name {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-item-address {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-loading {
    padding: 12px 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.autocomplete-no-results {
    padding: 12px 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.search-history-item-text {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.search-history-item-meta {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

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

.favorites-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.favorite-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    font-size: 13px;
    color: #333;
}

.favorite-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.favorite-btn-name {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.favorite-btn-category {
    font-size: 11px;
    color: #999;
}

.lane-guidance-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
}

.lane-guidance-display.show {
    display: block;
}

.lane-guidance-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    opacity: 0.9;
}

.lane-visual {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    justify-content: center;
}

.lane-indicator {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.lane-indicator.current {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
}

.lane-indicator.recommended {
    background: #51cf66;
    border-color: #51cf66;
}

.lane-guidance-text {
    font-size: 14px;
    text-align: center;
}

.speed-warning-display {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
    font-weight: 600;
}

.speed-warning-display.show {
    display: block;
}

.speed-warning-display.compliant {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.speed-warning-display.approaching {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.speed-warning-display.exceeding {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.speed-warning-text {
    font-size: 14px;
}

.speed-warning-details {
    font-size: 12px;
    margin-top: 6px;
    opacity: 0.9;
}

/* Variable Speed Limit Display */
.variable-speed-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
}

.variable-speed-display.show {
    display: block;
}

.variable-speed-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.variable-speed-icon {
    font-size: 16px;
}

.variable-speed-title {
    font-weight: 600;
}

.variable-speed-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.variable-speed-limit {
    font-size: 28px;
    font-weight: bold;
}

.variable-speed-info {
    font-size: 12px;
    text-align: right;
    opacity: 0.9;
}

.variable-speed-info-item {
    margin: 4px 0;
}

/* Phase 3 Features Styles */
.gesture-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: rgba(102, 126, 234, 0.9);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    z-index: 300;
    animation: shake-pulse 0.5s ease-out;
}

.gesture-indicator.show {
    display: flex;
}

@keyframes shake-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Battery indicator widget removed - battery optimization runs in background */

.theme-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.theme-option {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    font-weight: 500;
}

.theme-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.theme-option.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.theme-preview {
    width: 100%;
    height: 40px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.theme-preview.standard {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    border: 1px solid #ccc;
}

.theme-preview.satellite {
    background: linear-gradient(135deg, #8b7355 0%, #5a4a3a 100%);
}

.theme-preview.dark {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
}

.ml-predictions-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
}

.ml-predictions-section.show {
    display: block;
}

.ml-predictions-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.ml-prediction-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

.ml-prediction-item:last-child {
    margin-bottom: 0;
}

.ml-prediction-label {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.ml-prediction-details {
    font-size: 12px;
    opacity: 0.9;
}

.gesture-sensitivity-slider {
    width: 100%;
    margin-top: 8px;
}

.preference-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.preference-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.preference-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

/* Routing Mode Buttons */
.routing-mode-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #666;
}

.routing-mode-btn:hover {
    border-color: #667eea;
    background: #f5f5ff;
}

.routing-mode-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Vehicle Marker Icon - Custom SVG with directional indicator */
/* 3D Aerial View: Icon tilts with map for realistic top-down perspective */
.vehicle-marker-icon {
    width: 60px !important;
    height: 60px !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.vehicle-marker-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    /* Add subtle 3D depth effect */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3))
            drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Ensure smooth rotation and pitching transitions */
.vehicle-marker-icon>div {
    transition: transform 0.3s ease-out !important;
    will-change: transform;
    backface-visibility: hidden;
    /* Enable 3D transforms */
    transform-style: preserve-3d;
}

/* MapLibre marker container - ensure 3D transforms work */
.maplibregl-marker {
    transform-style: preserve-3d !important;
}

/* Add dynamic shadow that appears when map is pitched (3D view) */
.maplibregl-marker.vehicle-marker-icon::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 8px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.6;
    pointer-events: none;
}

/* ===== DARK MODE STYLES ===== */
/* Dark mode is applied via body.dark-mode class */

body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode html {
    background: #1a1a1a;
}

/* Bottom Sheet Dark Mode */
body.dark-mode .bottom-sheet {
    background: #2d2d2d;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

body.dark-mode .bottom-sheet-handle::before {
    background: #555;
}

body.dark-mode .bottom-sheet-header {
    border-bottom-color: #444;
}

body.dark-mode .bottom-sheet-header h2 {
    color: #e0e0e0;
}

body.dark-mode .bottom-sheet-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .bottom-sheet-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

body.dark-mode .bottom-sheet-content::-webkit-scrollbar-thumb {
    background: #555;
}

body.dark-mode .bottom-sheet-content::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Form Elements Dark Mode */
body.dark-mode label {
    color: #b0b0b0;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #3a3a3a;
    color: #e0e0e0;
    border-color: #555;
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    border-color: #667eea;
    background: #3a3a3a;
    color: #e0e0e0;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: #888;
}

/* Button Dark Mode */
body.dark-mode .btn-calculate {
    background: #667eea;
    color: white;
}

body.dark-mode .btn-calculate:hover {
    background: #5568d3;
}

body.dark-mode .btn-clear {
    background: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #555;
}

body.dark-mode .btn-clear:hover {
    background: #4a4a4a;
}

/* Routing Mode Buttons Dark Mode */
body.dark-mode .routing-mode-btn {
    background: #3a3a3a;
    border-color: #555;
    color: #b0b0b0;
}

body.dark-mode .routing-mode-btn:hover {
    border-color: #667eea;
    background: #3a3a3a;
}

body.dark-mode .routing-mode-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* FAB Dark Mode */
body.dark-mode .fab {
    background: #3a3a3a;
    color: #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .fab:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

/* Status Messages Dark Mode */
body.dark-mode .status.loading {
    background: #4a3a1a;
    color: #ffd700;
}

body.dark-mode .status.success {
    background: #1a3a1a;
    color: #51cf66;
}

body.dark-mode .status.error {
    background: #3a1a1a;
    color: #ff6b6b;
}

body.dark-mode .status.info {
    background: #1a2a3a;
    color: #74c0fc;
}

/* Result Container Dark Mode */
body.dark-mode .result {
    background: #3a3a3a;
    border: 1px solid #555;
}

/* Preference Items Dark Mode */
body.dark-mode .preference-item {
    background: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .preference-label {
    color: #b0b0b0;
}

/* Toggle Switch Dark Mode */
body.dark-mode .toggle-switch {
    background: #3a3a3a;
    border-color: #555;
}

body.dark-mode .toggle-switch.active {
    background: #4CAF50;
    border-color: #4CAF50;
}

/* Theme Option Dark Mode */
body.dark-mode .theme-option {
    background: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .theme-option:hover {
    border-color: #667eea;
    background: #4a4a4a;
}

body.dark-mode .theme-option.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Preferences Section Dark Mode */
body.dark-mode .preferences-section {
    background: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .preferences-section h3 {
    color: #e0e0e0;
}

/* Tabs Dark Mode */
body.dark-mode .tab-button {
    background: #3a3a3a;
    color: #b0b0b0;
    border-color: #555;
}

body.dark-mode .tab-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Tab Content Dark Mode */
body.dark-mode .tab-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

/* Battery indicator dark mode styles removed - widget removed */

/* Slider Dark Mode */
body.dark-mode .preference-slider {
    background: #555;
}

body.dark-mode .preference-slider::-webkit-slider-thumb {
    background: #667eea;
}

body.dark-mode .preference-slider::-moz-range-thumb {
    background: #667eea;
}

/* Location Input Group Dark Mode */
body.dark-mode .location-input-group {
    background: #3a3a3a;
}

body.dark-mode .location-btn {
    background: #4a4a4a;
    border-color: #666;
    color: #e0e0e0;
}

body.dark-mode .location-btn:hover {
    background: #555;
}

body.dark-mode .location-btn:active {
    background: #666;
}

/* Autocomplete Dropdown Dark Mode */
body.dark-mode .autocomplete-dropdown,
body.dark-mode .search-history-dropdown {
    background: #3a3a3a;
    border-color: #555;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .autocomplete-item,
body.dark-mode .history-item {
    background: #3a3a3a;
    color: #e0e0e0;
    border-color: #555;
}

body.dark-mode .autocomplete-item:hover,
body.dark-mode .history-item:hover {
    background: #4a4a4a;
}

/* Route Preview Dark Mode */
body.dark-mode .route-preview-container {
    background: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .route-preview-item {
    background: #2d2d2d;
    border-color: #555;
    color: #e0e0e0;
}

/* Route Comparison Dark Mode */
body.dark-mode .route-comparison-item {
    background: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .route-comparison-item:hover {
    background: #4a4a4a;
}

/* Trip History Dark Mode */
body.dark-mode .trip-history-item {
    background: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .trip-history-item:hover {
    background: #4a4a4a;
}

/* In-App Notification Dark Mode */
body.dark-mode .in-app-notification {
    background: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .in-app-notification.success {
    background: #1a3a1a;
    border-color: #51cf66;
    color: #51cf66;
}

body.dark-mode .in-app-notification.error {
    background: #3a1a1a;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

body.dark-mode .in-app-notification.info {
    background: #1a2a3a;
    border-color: #74c0fc;
    color: #74c0fc;
}

/* Voice Section Dark Mode */
body.dark-mode .voice-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body.dark-mode .voice-status,
body.dark-mode .voice-transcript,
body.dark-mode .voice-commands {
    background: rgba(0, 0, 0, 0.3);
    color: #e0e0e0;
}

/* ML Predictions Dark Mode */
body.dark-mode .ml-predictions-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body.dark-mode .ml-prediction-item {
    background: rgba(0, 0, 0, 0.2);
    border-left-color: rgba(255, 255, 255, 0.2);
}

/* Gesture Indicator Dark Mode */
body.dark-mode .gesture-indicator {
    background: rgba(102, 126, 234, 0.9);
}

/* Headings Dark Mode */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #e0e0e0;
}

/* Form Group Dark Mode */
body.dark-mode .form-group {
    background: transparent;
}

body.dark-mode .form-group[style*="background: #f5f5f5"] {
    background: #3a3a3a !important;
}

/* ============================================
   Turn Instruction Widget Styles
   ============================================ */

.turn-instruction-widget {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    max-width: calc(100% - 180px);
    /* Leave room for speed widget on right */
    min-width: 280px;
}

/* Next Turn Display - Main clickable area */
.next-turn-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(25, 118, 210, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.next-turn-display:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(25, 118, 210, 0.5);
}

.next-turn-display:active {
    transform: translateY(0);
}

/* Turn Icon Container */
.turn-icon-container {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.turn-icon {
    font-size: 28px;
    font-weight: bold;
}

/* Turn Info Container */
.turn-info-container {
    flex: 1;
    min-width: 0;
    /* Allow text truncation */
}

.turn-distance {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.turn-instruction {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.95;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.turn-street {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Expand Indicator */
.expand-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.expand-indicator.expanded {
    transform: rotate(180deg);
}

#expandIcon {
    font-size: 10px;
}

/* Expandable Instructions Panel */
.instructions-panel {
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 350px;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    color: #333;
}

.instructions-count {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.instructions-list {
    max-height: 290px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Individual Instruction Item */
.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

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

.instruction-item:hover {
    background: #f8f9fa;
}

.instruction-item.current {
    background: #E3F2FD;
    border-left: 3px solid #1976D2;
}

.instruction-item.passed {
    opacity: 0.5;
}

.instruction-item-icon {
    width: 32px;
    height: 32px;
    background: #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.instruction-item.current .instruction-item-icon {
    background: #1976D2;
    color: white;
}

.instruction-item-content {
    flex: 1;
    min-width: 0;
}

.instruction-item-text {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.instruction-item-street {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.instruction-item-status {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.instruction-item-status.current-status {
    color: #1976D2;
    font-weight: 600;
}

/* Preview icon in instruction items */
.instruction-item-preview {
    opacity: 0.3;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.instruction-item:hover .instruction-item-preview {
    opacity: 0.8;
}

.instruction-item-preview:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Preview marker on map */
.preview-marker {
    animation: markerPulse 1s ease-in-out infinite;
}

.preview-marker-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.preview-marker-label {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
}

@keyframes markerPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Dark Mode Support */
body.dark-mode .next-turn-display {
    background: linear-gradient(135deg, #0D47A1 0%, #1565C0 100%);
}

body.dark-mode .instructions-panel {
    background: rgba(30, 30, 30, 0.98);
}

body.dark-mode .instructions-header {
    background: #2a2a2a;
    border-color: #444;
    color: #fff;
}

body.dark-mode .instructions-count {
    color: #aaa;
}

body.dark-mode .instruction-item {
    border-color: #333;
}

body.dark-mode .instruction-item:hover {
    background: #333;
}

body.dark-mode .instruction-item.current {
    background: #1a3a5c;
}

body.dark-mode .instruction-item-icon {
    background: #444;
}

body.dark-mode .instruction-item-text {
    color: #e0e0e0;
}

body.dark-mode .instruction-item-street {
    color: #aaa;
}

body.dark-mode .instruction-item-status.current-status {
    color: #64B5F6;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .turn-instruction-widget {
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
        min-width: unset;
    }

    .next-turn-display {
        padding: 10px 12px;
        gap: 10px;
    }

    .turn-icon-container {
        width: 40px;
        height: 40px;
    }

    .turn-icon {
        font-size: 22px;
    }

    .turn-distance {
        font-size: 18px;
    }

    .turn-instruction {
        font-size: 13px;
    }

    .instructions-panel {
        max-height: 300px;
    }
}

/* ============================================
   Journey Summary Bar Styles
   ============================================ */

.journey-summary-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    padding: 12px 20px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.journey-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.journey-summary-icon {
    font-size: 20px;
}

.journey-summary-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.journey-summary-value {
    font-size: 18px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.journey-summary-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.journey-summary-divider {
    width: 1px;
    height: 36px;
    background: rgba(255, 255, 255, 0.3);
}

/* Dark Mode Support */
body.dark-mode .journey-summary-bar {
    background: linear-gradient(135deg, #0D47A1 0%, #1565C0 100%);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .journey-summary-bar {
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .journey-summary-icon {
        font-size: 16px;
    }

    .journey-summary-value {
        font-size: 16px;
    }

    .journey-summary-label {
        font-size: 10px;
    }

    .journey-summary-divider {
        height: 30px;
    }
}

/* ============================================
   Mobile UI Layout Reorganization
   Fixes overlapping elements for better usability
   ============================================ */

/* Z-Index Hierarchy (organized layers):
   1     - Map base
   10    - Route overlays, markers
   50    - Bottom sheet
   100   - Journey summary bar
   150   - FAB container
   200   - Navigation control buttons
   250   - Turn instruction widget
   300   - Speed widget
   350   - Battery indicator
   400   - MapLibre controls (positioned bottom-left)
   500   - Notification container
   600   - Gesture indicator
   1000+ - Dropdowns/modals
*/

/* Update z-index for turn instruction widget */
.turn-instruction-widget {
    z-index: 250 !important;
}

/* Battery indicator z-index removed - widget removed */

/* Update z-index for gesture indicator */
.gesture-indicator {
    z-index: 600 !important;
}

/* MapLibre navigation controls - ensure proper z-index and touch targets */
.maplibregl-ctrl-group {
    z-index: 400 !important;
}

.maplibregl-ctrl-group button {
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
}

/* ============================================
   Mobile Layout - 768px Breakpoint
   ============================================ */
@media (max-width: 768px) {
    /* Turn instruction widget - constrain width to leave room for speed widget */
    .turn-instruction-widget {
        max-width: calc(100% - 140px);
        left: 10px;
    }


    /* MapLibre controls - ensure adequate spacing from bottom sheet */
    .maplibregl-ctrl-bottom-left {
        bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
        left: 10px !important;
    }
}

/* ============================================
   Mobile Layout - 480px Breakpoint (Small Phones)
   ============================================ */
@media (max-width: 480px) {
    /* Turn instruction widget - full width but leave gap at top-right for speed */
    .turn-instruction-widget {
        top: 10px;
        left: 10px;
        right: auto;
        max-width: calc(100% - 120px);
    }

    /* Speed widget - scale down slightly on small screens */
    .speed-widget {
        top: 10px !important;
        right: 10px !important;
        padding: 8px !important;
        min-width: 90px !important;
        transform: scale(0.9);
        transform-origin: top right;
    }

    /* Notification container - center on mobile for better visibility */
    .notification-container {
        top: 10px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        max-width: calc(100% - 20px) !important;
        width: auto !important;
    }

    /* Navigation control buttons - adjust for small screens */
    .nav-control-buttons {
        bottom: calc(130px + env(safe-area-inset-bottom, 0px)) !important;
        right: 10px !important;
    }

    /* MapLibre controls - move up to avoid FAB overlap */
    .maplibregl-ctrl-bottom-left {
        bottom: calc(180px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Ensure FAB buttons don't overlap with journey bar */
    .fab-container {
        bottom: calc(130px + env(safe-area-inset-bottom, 0px));
    }
}

/* ============================================
   Speed Widget Styles
   ============================================ */
.speed-widget {
    z-index: 300 !important;
    transition: transform 0.2s ease;
}

/* Notification Container Styles */
.notification-container {
    z-index: 500 !important;
    pointer-events: none;
}

.notification-container > * {
    pointer-events: auto;
}

/* Navigation Control Buttons */
.nav-control-buttons {
    z-index: 200 !important;
}

/* ============================================
   Dark Mode Support for Mobile Layout
   ============================================ */
body.dark-mode .speed-widget {
    background: rgba(30, 30, 30, 0.95) !important;
    border-left-color: #66BB6A !important;
}

body.dark-mode .speed-widget #speedValue {
    color: #e0e0e0 !important;
}

body.dark-mode .speed-widget #speedLimitCircle {
    background: #2a2a2a !important;
    border-color: #EF5350 !important;
}

body.dark-mode .speed-widget #speedLimitValue {
    color: #e0e0e0 !important;
}