/* Outset Web Map - Responsive Styles */

/* CSS Custom Properties - Light Theme (Default) */
:root {
    /* Primary */
    --primary: #1A73E8;
    --primary-light: #8AB4F8;
    --on-primary: #FFFFFF;
    --primary-container: #D3E3FD;

    /* Surface */
    --background: #FFFBFE;
    --surface: #FFFFFF;
    --on-surface: #1C1B1F;
    --surface-variant: #E7E0EC;
    --on-surface-variant: #49454F;
    --outline: #79747E;
    --outline-variant: #CAC4D0;

    /* Map */
    --route-line: #2196F3;
    --route-casing: #FFFFFF;
    --dropped-pin: #E53935;
    --location-puck: #2196F3;

    /* Categories */
    --cat-food: #FF6B6B;
    --cat-gas: #4CAF50;
    --cat-lodging: #FF9800;
    --cat-coffee: #795548;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);

    /* Spacing */
    --spacing-1: 4px;
    --spacing-2: 8px;
    --spacing-3: 12px;
    --spacing-4: 16px;
    --spacing-5: 20px;
    --spacing-6: 24px;

    /* Border Radius */
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 16px;
    --radius-pill: 28px;

    /* Typography */
    --font-family: 'Overpass', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Safe Areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* Dark Theme */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #8AB4F8;
        --primary-light: #AECBFA;
        --on-primary: #062E6F;
        --primary-container: #0842A0;

        --background: #1C1B1F;
        --surface: #2B2930;
        --on-surface: #E6E1E5;
        --surface-variant: #49454F;
        --on-surface-variant: #CAC4D0;
        --outline: #938F99;
        --outline-variant: #49454F;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
    }
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.5;
    color: var(--on-surface);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input {
    font-family: inherit;
    border: none;
    outline: none;
    background: none;
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* Map Container */
#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* MapLibre Controls Override */
.maplibregl-ctrl-attrib {
    font-size: 10px !important;
    background: rgba(255, 255, 255, 0.7) !important;
    padding: 2px 5px !important;
}

@media (prefers-color-scheme: dark) {
    .maplibregl-ctrl-attrib {
        background: rgba(0, 0, 0, 0.7) !important;
        color: #ccc !important;
    }
    .maplibregl-ctrl-attrib a {
        color: var(--primary) !important;
    }
}

/* Hide default MapLibre controls */
.maplibregl-ctrl-top-right,
.maplibregl-ctrl-top-left,
.maplibregl-ctrl-bottom-left {
    display: none;
}

/* ===== HYBRID SEARCH SHEET ===== */

/* Animation timing - spring-like bounce */
:root {
    --spring-easing: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-duration: 400ms;
}

.hybrid-search-sheet {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;

    /* Collapsed state defaults */
    height: 56px;
    width: 91%;
    max-width: 580px;

    border-radius: 36px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);

    /* Smooth transitions for programmatic state changes */
    transition:
        height var(--spring-duration) var(--spring-easing),
        width var(--spring-duration) var(--spring-easing),
        border-radius var(--spring-duration) var(--spring-easing),
        bottom var(--spring-duration) var(--spring-easing);

    overflow: hidden;
    touch-action: none; /* For gesture handling */
}

.hybrid-search-sheet[data-state="partial"] {
    height: 50vh;
    height: 50dvh;
    width: 96%;
    border-radius: 16px;
    bottom: 0;
}

.hybrid-search-sheet[data-state="expanded"] {
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: none;
    bottom: 0;
    border-radius: 16px 16px 0 0;
}

/* Drag handle - absolutely positioned to not affect layout */
.sheet-drag-handle {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 4px;
    background: var(--outline-variant);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 200ms;
    z-index: 1;
}

.hybrid-search-sheet[data-state="partial"] .sheet-drag-handle,
.hybrid-search-sheet[data-state="expanded"] .sheet-drag-handle {
    opacity: 1;
}

/* Collapsed pill content - absolutely positioned for perfect centering */
.collapsed-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    gap: 12px;
    padding: 0 24px;
    cursor: pointer;
    opacity: 1;
    transition: opacity 150ms;
}

.collapsed-content .search-icon {
    width: 20px;
    height: 20px;
    color: var(--on-surface-variant);
}

.collapsed-content span {
    font-size: 16px;
    color: var(--on-surface-variant);
}

.hybrid-search-sheet:not([data-state="collapsed"]) .collapsed-content {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

/* Expanded content */
.expanded-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-top: 24px; /* Space for drag handle */
    opacity: 0;
    transition: opacity 200ms;
    pointer-events: none;
}

.hybrid-search-sheet[data-state="partial"] .expanded-content,
.hybrid-search-sheet[data-state="expanded"] .expanded-content {
    opacity: 1;
    pointer-events: auto;
}

/* Search header */
.search-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--outline-variant);
    flex-shrink: 0;
}

.search-header .collapse-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-surface);
    border-radius: 50%;
    transition: background 0.2s;
}

.search-header .collapse-btn:hover {
    background: var(--surface-variant);
}

.search-header .collapse-btn svg {
    width: 24px;
    height: 24px;
}

.search-header input {
    flex: 1;
    height: 40px;
    font-size: 16px;
    color: var(--on-surface);
    background: transparent;
}

.search-header input::placeholder {
    color: var(--on-surface-variant);
}

.search-header .search-clear {
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--on-surface-variant);
    border-radius: 50%;
    transition: background 0.2s;
}

.search-header .search-clear:hover {
    background: var(--surface-variant);
}

.search-header .search-clear svg {
    width: 20px;
    height: 20px;
}

.search-header.has-value .search-clear {
    display: flex;
}

/* Discovery section */
.discovery-section {
    padding: 16px;
    flex-shrink: 0;
}

.discovery-section h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--on-surface-variant);
    margin-bottom: 12px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.category-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 4px;
    background: var(--surface-variant);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.category-tile:hover {
    background: var(--outline-variant);
}

.category-tile:active {
    transform: scale(0.95);
}

.category-tile.active {
    background: var(--primary);
    color: var(--on-primary);
}

.category-tile svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
    margin-bottom: 4px;
}

.category-tile.active svg {
    color: var(--on-primary);
}

.category-tile span {
    font-size: 11px;
    color: var(--on-surface-variant);
    text-align: center;
}

.category-tile.active span {
    color: var(--on-primary);
}

/* Search results list */
.search-results-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.search-results-list:empty {
    display: none;
}

/* Search result item (reused from old styles) */
.search-result {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    padding: var(--spacing-3) 0;
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-result:hover {
    background: var(--surface-variant);
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.search-result:not(:last-child) {
    border-bottom: 1px solid var(--outline-variant);
}

.result-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-container);
    border-radius: var(--radius-small);
    color: var(--primary);
    flex-shrink: 0;
}

.result-icon svg {
    width: 20px;
    height: 20px;
}

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

.result-name {
    font-weight: 500;
    font-size: 15px;
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-address {
    font-size: 13px;
    color: var(--on-surface-variant);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.result-distance {
    font-size: 13px;
    color: var(--on-surface-variant);
    white-space: nowrap;
    flex-shrink: 0;
}

.search-no-results {
    padding: var(--spacing-6) var(--spacing-4);
    text-align: center;
    color: var(--on-surface-variant);
}

/* Desktop: wider sheet */
@media (min-width: 768px) {
    .hybrid-search-sheet {
        max-width: 500px;
    }

    .hybrid-search-sheet[data-state="expanded"] {
        height: 70vh;
        height: 70dvh;
        max-width: 500px;
        bottom: var(--spacing-6);
        left: var(--spacing-6);
        transform: none;
        border-radius: 16px;
    }

    .hybrid-search-sheet[data-state="partial"] {
        max-width: 500px;
        bottom: var(--spacing-6);
        left: var(--spacing-6);
        transform: none;
    }
}

/* Map Controls */
.map-controls {
    position: absolute;
    bottom: calc(var(--safe-bottom) + 88px); /* Above collapsed sheet */
    right: var(--spacing-4);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    z-index: 90;
    transition: bottom var(--spring-duration) var(--spring-easing),
                opacity 300ms ease;
}

/* Hide controls when sheet is expanded */
.hybrid-search-sheet[data-state="partial"] ~ .map-controls,
.hybrid-search-sheet[data-state="expanded"] ~ .map-controls {
    opacity: 0;
    pointer-events: none;
}

@media (min-width: 768px) {
    .map-controls {
        right: var(--spacing-6);
        bottom: auto;
        top: calc(var(--safe-top) + var(--spacing-4));
    }

    .hybrid-search-sheet[data-state="partial"] ~ .map-controls,
    .hybrid-search-sheet[data-state="expanded"] ~ .map-controls {
        opacity: 1;
        pointer-events: auto;
    }
}

.map-control-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    color: var(--on-surface-variant);
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.map-control-btn:hover {
    background: var(--surface-variant);
}

.map-control-btn:active {
    transform: scale(0.95);
}

.map-control-btn.active {
    color: var(--primary);
}

.map-control-btn svg {
    width: 24px;
    height: 24px;
}

/* Compass button */
.compass-btn {
    display: none; /* Hidden until map rotates */
}

.compass-btn.visible {
    display: flex;
}

.compass-btn svg {
    transition: transform 0.3s ease;
}

/* Get App Link (desktop only) */
.get-app-link {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 16px);
    right: var(--spacing-4);
    display: none;
    align-items: center;
    gap: var(--spacing-2);
    height: 40px;
    padding: 0 var(--spacing-4);
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.2s ease;
    z-index: 100;
}

.get-app-link:hover {
    opacity: 0.9;
}

.get-app-link svg {
    width: 16px;
    height: 16px;
}

@media (min-width: 768px) {
    .get-app-link {
        display: flex;
        bottom: var(--spacing-6);
        right: var(--spacing-6);
    }
}

/* Category Bar (legacy - kept for reference) */
.category-bar {
    position: absolute;
    bottom: calc(var(--safe-bottom) + var(--spacing-4));
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-4);
    z-index: 90;
}

@media (min-width: 768px) {
    .category-bar {
        padding: 0 var(--spacing-6);
    }
}

.category-chips {
    display: flex;
    gap: var(--spacing-2);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: var(--spacing-1) 0;
}

.category-chips::-webkit-scrollbar {
    display: none;
}

.category-chip {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    height: 40px;
    padding: 0 var(--spacing-4);
    background: var(--surface);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.1s ease;
}

.category-chip:hover {
    background: var(--surface-variant);
}

.category-chip:active {
    transform: scale(0.97);
}

.category-chip.active {
    background: var(--primary);
    color: var(--on-primary);
}

.chip-icon {
    font-size: 16px;
}

.chip-label {
    font-size: 14px;
    font-weight: 500;
}

.get-app-link {
    display: none;
    align-items: center;
    gap: var(--spacing-2);
    height: 40px;
    padding: 0 var(--spacing-4);
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.get-app-link:hover {
    opacity: 0.9;
}

.get-app-link svg {
    width: 16px;
    height: 16px;
}

@media (min-width: 768px) {
    .get-app-link {
        display: flex;
    }
}

/* Bottom Sheet */
.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: var(--radius-large) var(--radius-large) 0 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 200;
    max-height: 70vh;
    overflow-y: auto;
    padding-bottom: var(--safe-bottom);
}

.bottom-sheet.visible {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .bottom-sheet {
        left: var(--spacing-6);
        right: auto;
        bottom: var(--spacing-6);
        width: 380px;
        border-radius: var(--radius-large);
        max-height: calc(100vh - 200px);
    }
}

.sheet-handle {
    width: 32px;
    height: 4px;
    background: var(--outline-variant);
    border-radius: 2px;
    margin: var(--spacing-3) auto;
}

@media (min-width: 768px) {
    .sheet-handle {
        display: none;
    }
}

.sheet-content {
    padding: 0 var(--spacing-4) var(--spacing-4);
}

.place-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-3);
}

.place-name {
    font-size: 22px;
    font-weight: 500;
    color: var(--on-surface);
    line-height: 1.3;
}

.sheet-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-surface-variant);
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.sheet-close:hover {
    background: var(--surface-variant);
}

.sheet-close svg {
    width: 20px;
    height: 20px;
}

/* Place Category (subtitle) */
.place-category {
    font-size: 14px;
    color: var(--on-surface-variant);
    margin-top: var(--spacing-1);
}

.place-category:empty {
    display: none;
}

/* ===== OPENING HOURS SECTION ===== */
.hours-section {
    margin-top: var(--spacing-3);
}

/* Hours Status Button */
.hours-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    width: 100%;
    padding: var(--spacing-3);
    background: var(--surface-variant);
    border-radius: var(--radius-medium);
    cursor: pointer;
    transition: background 0.15s ease;
}

.hours-status:hover {
    background: var(--outline-variant);
}

.hours-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hours-status.status-open .status-dot {
    background: #4CAF50;
}

.hours-status.status-closing-soon .status-dot {
    background: #FF9800;
}

.hours-status.status-closed .status-dot {
    background: #F44336;
}

.hours-status .status-text {
    flex: 1;
    font-size: 14px;
    color: var(--on-surface);
    text-align: left;
}

.hours-status.status-open .status-text {
    color: #4CAF50;
}

.hours-status.status-closing-soon .status-text {
    color: #FF9800;
}

.hours-status.status-closed .status-text {
    color: #F44336;
}

.hours-status .chevron {
    width: 20px;
    height: 20px;
    color: var(--on-surface-variant);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.hours-status[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

/* Weekly Schedule */
.weekly-schedule {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.2s ease;
    padding: 0 var(--spacing-3);
    margin-top: 0;
}

.weekly-schedule:not(.collapsed) {
    max-height: 300px;
    opacity: 1;
    padding: var(--spacing-3);
    margin-top: var(--spacing-2);
    background: var(--surface-variant);
    border-radius: var(--radius-medium);
}

.schedule-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-2) 0;
    font-size: 14px;
    border-bottom: 1px solid var(--outline-variant);
}

.schedule-row:last-child {
    border-bottom: none;
}

.schedule-row.today {
    font-weight: 600;
    color: var(--primary);
}

.schedule-day {
    color: var(--on-surface);
}

.schedule-hours {
    color: var(--on-surface-variant);
}

.schedule-row.today .schedule-hours {
    color: var(--primary);
}

.schedule-hours.closed {
    color: #F44336;
}

/* ===== AMENITY CHIPS ===== */
.amenity-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    margin-top: var(--spacing-3);
}

.amenity-chips:empty {
    display: none;
}

.amenity-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--surface-variant);
    border-radius: 16px;
    font-size: 13px;
    color: var(--on-surface-variant);
    white-space: nowrap;
}

.amenity-chip .chip-icon {
    font-size: 14px;
}

/* Chip type variations */
.amenity-chip.chip-accessibility {
    background: #E3F2FD;
    color: #1565C0;
}

.amenity-chip.chip-accessibility-limited {
    background: #FFF3E0;
    color: #E65100;
}

.amenity-chip.chip-outdoor {
    background: #E8F5E9;
    color: #2E7D32;
}

.amenity-chip.chip-delivery,
.amenity-chip.chip-takeaway {
    background: #FFF8E1;
    color: #F57F17;
}

.amenity-chip.chip-cuisine {
    background: #FCE4EC;
    color: #C2185B;
}

.amenity-chip.chip-brand {
    background: #E8EAF6;
    color: #3949AB;
}

@media (prefers-color-scheme: dark) {
    .amenity-chip {
        background: var(--surface-variant);
        color: var(--on-surface-variant);
    }

    .amenity-chip.chip-accessibility {
        background: rgba(33, 150, 243, 0.2);
        color: #64B5F6;
    }

    .amenity-chip.chip-accessibility-limited {
        background: rgba(255, 152, 0, 0.2);
        color: #FFB74D;
    }

    .amenity-chip.chip-outdoor {
        background: rgba(76, 175, 80, 0.2);
        color: #81C784;
    }

    .amenity-chip.chip-delivery,
    .amenity-chip.chip-takeaway {
        background: rgba(255, 193, 7, 0.2);
        color: #FFD54F;
    }

    .amenity-chip.chip-cuisine {
        background: rgba(233, 30, 99, 0.2);
        color: #F48FB1;
    }

    .amenity-chip.chip-brand {
        background: rgba(63, 81, 181, 0.2);
        color: #7986CB;
    }
}

.place-details {
    margin-top: var(--spacing-4);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.place-detail {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    font-size: 14px;
    color: var(--on-surface-variant);
}

.place-detail svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.place-detail a {
    color: var(--primary);
}

.place-actions {
    display: flex;
    gap: var(--spacing-3);
    margin-top: var(--spacing-5);
}

/* Action Buttons */
.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    height: 48px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.action-btn:active {
    transform: scale(0.98);
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

.action-btn.primary {
    background: var(--primary);
    color: var(--on-primary);
}

.action-btn.primary:hover {
    opacity: 0.9;
}

.action-btn.secondary {
    background: var(--surface-variant);
    color: var(--on-surface);
}

.action-btn.secondary:hover {
    background: var(--outline-variant);
}

/* Route View */
.route-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    z-index: 300;
    display: none;
    flex-direction: column;
}

.route-view.visible {
    display: flex;
}

@media (min-width: 768px) {
    .route-view {
        left: auto;
        width: 380px;
        top: var(--spacing-6);
        bottom: var(--spacing-6);
        border-radius: var(--radius-large);
        box-shadow: var(--shadow-lg);
        overflow: hidden;
    }
}

.route-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: calc(var(--safe-top) + var(--spacing-4)) var(--spacing-4) var(--spacing-4);
    background: var(--surface);
    border-bottom: 1px solid var(--outline-variant);
}

@media (min-width: 768px) {
    .route-header {
        padding-top: var(--spacing-4);
    }
}

.route-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-surface);
    border-radius: 50%;
    transition: background 0.2s ease;
}

.route-back:hover {
    background: var(--surface-variant);
}

.route-back svg {
    width: 24px;
    height: 24px;
}

.route-destination {
    flex: 1;
    min-width: 0;
}

.route-destination span:first-child {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-destination span:last-child {
    display: block;
    font-size: 14px;
    color: var(--on-surface-variant);
    margin-top: 2px;
}

.route-directions {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-4);
}

.direction-step {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    padding: var(--spacing-3) 0;
}

.direction-step:not(:last-child) {
    border-bottom: 1px solid var(--outline-variant);
}

.step-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-variant);
    border-radius: 50%;
    font-size: 18px;
    flex-shrink: 0;
}

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

.step-instruction {
    font-size: 15px;
    color: var(--on-surface);
}

.step-distance {
    font-size: 13px;
    color: var(--on-surface-variant);
    margin-top: 2px;
}

.route-footer {
    padding: var(--spacing-4);
    padding-bottom: calc(var(--safe-bottom) + var(--spacing-4));
    background: var(--surface);
    border-top: 1px solid var(--outline-variant);
}

@media (min-width: 768px) {
    .route-footer {
        padding-bottom: var(--spacing-4);
    }
}

.route-footer-text {
    font-size: 13px;
    color: var(--on-surface-variant);
    text-align: center;
    margin-bottom: var(--spacing-3);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.loading-overlay.visible {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--surface);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 80px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    pointer-events: none;
}

.toast {
    padding: var(--spacing-3) var(--spacing-4);
    background: var(--surface);
    color: var(--on-surface);
    border-radius: var(--radius-small);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    animation: toast-in 0.3s ease;
    pointer-events: auto;
}

.toast.error {
    background: var(--cat-food);
    color: white;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* MapLibre Popup Styling */
.maplibregl-popup-content {
    padding: var(--spacing-3) var(--spacing-4);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-family);
    font-size: 14px;
    max-width: 250px;
}

.maplibregl-popup-close-button {
    font-size: 20px;
    padding: 4px 8px;
    color: var(--on-surface-variant);
}

@media (prefers-color-scheme: dark) {
    .maplibregl-popup-content {
        background: var(--surface);
        color: var(--on-surface);
    }
}

/* User Location Marker */
.user-location-marker {
    width: 20px;
    height: 20px;
    background: var(--location-puck);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

/* Place Marker */
.place-marker {
    width: 32px;
    height: 32px;
    background: var(--dropped-pin);
    border: 3px solid white;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: var(--shadow-md);
}

.place-marker-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(45deg);
    color: white;
    font-size: 14px;
}

/* POI Selection Ring (handled by MapLibre, but animation keyframes here) */
@keyframes poi-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ===== SETTINGS BUTTON (top-left) ===== */
.settings-btn {
    position: fixed;
    top: calc(var(--safe-top) + 16px);
    left: 16px;
    z-index: 100;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    color: var(--on-surface-variant);
    transition: background 0.2s ease, transform 0.1s ease;
}

@media (prefers-color-scheme: dark) {
    .settings-btn {
        background: rgba(43, 41, 48, 0.85);
    }
}

.settings-btn:hover {
    background: var(--surface-variant);
}

.settings-btn:active {
    transform: scale(0.95);
}

.settings-btn svg {
    width: 24px;
    height: 24px;
}

/* Hide settings button when search sheet is expanded */
.hybrid-search-sheet[data-state="partial"] ~ .settings-btn,
.hybrid-search-sheet[data-state="expanded"] ~ .settings-btn {
    opacity: 0;
    pointer-events: none;
}

/* Desktop: adjust settings button position */
@media (min-width: 768px) {
    .settings-btn {
        top: calc(var(--safe-top) + 24px);
        left: 24px;
    }
}

/* ===== SETTINGS OVERLAY ===== */

/* Mobile: Full screen slide-down */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    background: var(--background);
    transform: translateY(-100%);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.settings-overlay.visible {
    transform: translateY(0);
}

/* Desktop: Centered modal with backdrop */
@media (min-width: 768px) {
    .settings-overlay {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding-top: 48px;
        background: rgba(0, 0, 0, 0.5);
        transform: none;
        opacity: 0;
        pointer-events: none;
        transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
    }

    .settings-overlay.visible {
        opacity: 1;
        pointer-events: auto;
    }
}

.settings-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--background);
}

/* Desktop: Modal styling for container */
@media (min-width: 768px) {
    .settings-container {
        height: auto;
        max-height: calc(100vh - 96px);
        border-radius: var(--radius-large);
        box-shadow: var(--shadow-lg);
        overflow: hidden;
    }
}

/* Settings Header */
.settings-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: calc(var(--safe-top) + var(--spacing-4)) var(--spacing-4) var(--spacing-4);
    background: var(--surface);
    border-bottom: 1px solid var(--outline-variant);
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .settings-header {
        padding-top: var(--spacing-4);
    }
}

.settings-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-surface);
    border-radius: 50%;
    transition: background 0.2s ease;
}

.settings-back:hover {
    background: var(--surface-variant);
}

.settings-back svg {
    width: 24px;
    height: 24px;
}

.settings-header h1 {
    font-size: 20px;
    font-weight: 500;
    color: var(--on-surface);
}

/* Settings Content */
.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-4);
    padding-bottom: calc(var(--safe-bottom) + var(--spacing-6));
}

@media (min-width: 768px) {
    .settings-content {
        padding: var(--spacing-5);
        padding-bottom: var(--spacing-5);
    }
}

/* Settings Sections */
.settings-section {
    margin-bottom: var(--spacing-6);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h2 {
    font-size: 14px;
    font-weight: 500;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-3);
    padding-left: var(--spacing-2);
}

.settings-list {
    background: var(--surface);
    border-radius: var(--radius-medium);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* Settings Items */
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--spacing-4);
    background: transparent;
    color: var(--on-surface);
    font-size: 16px;
    text-align: left;
    text-decoration: none;
    border-bottom: 1px solid var(--outline-variant);
    transition: background 0.15s ease;
}

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

.settings-item:not(.static):hover {
    background: var(--surface-variant);
}

.settings-item:not(.static):active {
    background: var(--outline-variant);
}

.settings-item.static {
    cursor: default;
}

.settings-item .chevron {
    width: 20px;
    height: 20px;
    color: var(--on-surface-variant);
    transition: transform 0.2s ease;
}

.settings-item.active .chevron {
    transform: rotate(90deg);
}

.settings-item .external-icon {
    width: 18px;
    height: 18px;
    color: var(--on-surface-variant);
}

.settings-value {
    color: var(--on-surface-variant);
    font-size: 14px;
}

/* Expandable Content */
.settings-expandable {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-expandable.expanded {
    max-height: 1000px;
}

.expandable-content {
    padding: var(--spacing-4);
    background: var(--surface-variant);
    border-bottom: 1px solid var(--outline-variant);
}

.expandable-content p {
    margin-bottom: var(--spacing-3);
    color: var(--on-surface);
    font-size: 15px;
    line-height: 1.6;
}

.expandable-content p:last-child {
    margin-bottom: 0;
}

.expandable-content h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--on-surface);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: var(--spacing-4);
    margin-bottom: var(--spacing-2);
}

.expandable-content h3:first-child {
    margin-top: 0;
}

.expandable-content ul,
.expandable-content ol {
    margin-bottom: var(--spacing-3);
    padding-left: var(--spacing-5);
}

.expandable-content li {
    font-size: 14px;
    color: var(--on-surface-variant);
    margin-bottom: var(--spacing-1);
    line-height: 1.5;
}

.expandable-content .privacy-tagline {
    font-weight: 500;
    color: var(--primary);
    font-style: italic;
    margin-top: var(--spacing-4);
}
