/* Marga Premium Apple-Inspired Dark-Mode Layout */

/* 1. Global Reset & Defaults */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body, #map { width: 100%; height: 100vh; margin: 0; padding: 0; overflow: hidden; }
html, body { color: #ffffff; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
::-webkit-scrollbar { display: none; }

/* 2. Cinematic Map Container */
#map { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1; display: block !important; }
/* 2. Cinematic Map Container (Infinite Void Upgrade) */
#map::after {
    content: ''; 
    position: absolute; 
    top: 0; left: 0; 
    width: 100vw; height: 100vh; 
    pointer-events: none; 
    z-index: 2;
    background: radial-gradient(circle at 50% 50%, transparent 15%, #0a0a0c 95%),
                linear-gradient(to bottom, #0a0a0c 0%, transparent 12%, transparent 75%, #0a0a0c 100%);
    opacity: 1; 
    transition: all 0.5s ease-in-out;
}

/* 3. Hero Overlay & Premium Typography */
.hero-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100vh; z-index: 10;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: background-color 0.5s ease-in-out, backdrop-filter 0.5s ease-in-out, -webkit-backdrop-filter 0.5s ease-in-out;
}
body.map-active .hero-overlay { opacity: 0 !important; pointer-events: none !important; visibility: hidden; }

.leaflet-control-container, .leaflet-routing-container, .leaflet-routing-alternatives-container {
    display: none !important; visibility: hidden !important; opacity: 0 !important; pointer-events: none !important;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: rgba(20, 20, 25, 0.85) !important; backdrop-filter: blur(20px) !important; color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important; border-radius: 12px !important;
}
.leaflet-popup-content { font-family: inherit !important; font-size: 0.88rem !important; line-height: 1.4; padding: 4px 6px !important; }
.leaflet-popup-content b { color: #00f0ff; }
.leaflet-container a.leaflet-popup-close-button { color: rgba(255, 255, 255, 0.4) !important; padding: 6px 6px 0 0 !important; }

.hero-brand { 
    text-align: center; width: 100%; opacity: 1; transition: all 0.5s ease-in-out; 
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; margin-bottom: 120px; 
}

.hero-title {
    font-size: 4rem; font-weight: 300; letter-spacing: 0.2em; text-transform: uppercase; color: #ffffff;
    background: linear-gradient(180deg, #ffffff 30%, #888890 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; 
    margin: 0; line-height: 1; 
}
.hero-social-proof { font-size: 14px; color: rgba(255, 255, 255, 0.6); margin-top: 8px; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; }
.hero-subtitle { font-size: 1rem; font-weight: 500; color: #ffffff !important; letter-spacing: 0.3em; text-transform: uppercase; margin: 0; -webkit-text-fill-color: initial !important; text-shadow: 0px 2px 4px rgba(0,0,0,0.5); z-index: 20; position: relative; }

/* 4. BOTTOM SEARCH BAR (Dynamic Breathing Setup) */
.search-container {
    position: fixed !important;
    bottom: 40px !important;          
    top: auto !important;             
    left: 50% !important;
    transform: translateX(-50%) !important;
    
    /* Starts small and compact */
    width: 45% !important;
    min-width: 320px;
    max-width: 700px !important;      
    z-index: 4000 !important;         
    
    /* Smooth width expansion curve */
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Expands outward when the user clicks inside */
.search-container:focus-within {
    width: 85% !important; 
}

.search-pill {
    display: flex;
    align-items: center;
    background: rgba(15, 15, 18, 0.85); 
    backdrop-filter: blur(24px) saturate(180%);        
    
    /* Hardware lighting borders */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 40px;   
    padding: 8px 8px 8px 24px;
    
    /* Deep shadow */
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.search-pill:hover, .search-pill:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08); 
}

.search-pill input {
    flex: 1; background: transparent; border: none; color: #fff; font-size: 16px; outline: none; font-family: inherit; font-weight: 500; padding-right: 15px;
    transition: color 0.3s ease;
}

.search-pill input::placeholder { color: #666; }

.search-pill button {
    background: #00f0ff; border: none; width: 42px; height: 42px; border-radius: 50%; color: #000; font-size: 18px; cursor: pointer; display: flex; justify-content: center; align-items: center; transition: background 0.2s, transform 0.2s; flex-shrink: 0;
}

.search-pill button:hover { background: #fff; transform: scale(1.05); }

body.map-active .search-container { bottom: 40px !important; top: auto !important; transform: translateX(-50%) !important; }

/* ========================================================= */
/* --- 5. NEW FLOATING TOP TOOLBAR (Apple Native Style) --- */
/* ========================================================= */
#top-toolbar {
    position: absolute;
    top: 24px;
    right: 24px; /* Pins it to the Top Right */
    left: auto;
    transform: none;
    display: flex;
    gap: 10px;
    z-index: 4000;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

body:not(.logged-in) #top-toolbar {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-20px);
}

.toolbar-group {
    display: flex;
    gap: 12px;
    pointer-events: auto; /* Re-enables clicking on the pills */
}

.toolbar-pill {
    background: rgba(30, 30, 35, 0.65); 
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.15); 
    border-radius: 14px; /* Slightly rounder to match iOS */
    padding: 4px; /* REDUCED: Pulls the borders tight against the buttons */
    display: flex;
    align-items: center;
    gap: 2px; /* Tighter gap between buttons */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.divider-vertical {
    width: 1px;
    height: 22px; /* Taller divider to match the new button height */
    background: rgba(255, 255, 255, 0.15);
    margin: 0 4px;
}

/* Dropdown Container */
.dropdown-container {
    position: relative; 
    display: flex;
    align-items: center;
}

/* Minimal Vector Icons - UPGRADED SIZING */
.icon-toggle {
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 44px; /* WIDER: Fills the side */
    height: 36px; /* TALLER: Stretches top to bottom */
    border-radius: 10px; /* Matches the inner curve of the pill */
    transition: all 0.2s ease; 
    color: #ffffff; 
    opacity: 0.5;
}

.icon-toggle input { display: none; }
.icon-toggle:hover { opacity: 0.9; background: rgba(255, 255, 255, 0.1); }
.icon-toggle:has(input:checked) { 
    opacity: 1; 
    color: #00f0ff; 
    background: rgba(0, 240, 255, 0.15); /* Fills the whole box cyan when active */
    box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.4);
}

.icon-btn {
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: #ffffff; 
    opacity: 0.5; 
    transition: all 0.2s ease; 
    padding: 0 12px; 
    height: 36px; /* TALLER: Matches the utility toggles */
    border-radius: 10px;
}
.icon-btn:hover { 
    opacity: 1; 
    background: rgba(255, 255, 255, 0.1); /* Adds the grey highlight box to the filters/heart too! */
}

.avatar-circle {
    width: 32px; 
    height: 32px; 
    border-radius: 50%; 
    background: #00f0ff; 
    color: #000; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 800; 
    font-size: 14px; 
    cursor: pointer;
    margin: 2px 4px; /* Balances the avatar inside the new tight padding */
}

/* Dropdown Menus */
.dropdown-container:hover .dropdown-menu,
.dropdown-container:focus-within .dropdown-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px; /* UPDATED: More padding for breathing room */
    min-width: 220px; /* UPDATED: Wider to fit the text */
    box-shadow: 0 16px 40px rgba(0,0,0,0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 5000;
}

#profile-name { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 2px; }

/* NEW: Forced Single Line Profile Tag */
#profile-tag { 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px !important;
    font-size: 10.5px !important; 
    max-width: 100%;
    display: block;
}

.dropdown-btn { width: 100%; background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #aaa; padding: 10px; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; text-transform: uppercase; transition: all 0.2s; }
.dropdown-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }


/* 6. Dynamic Location Card (Master Layout Lock) */
/* 6. Dynamic Location Card (Master Layout Lock) */
#location-card {
    display: none; flex-direction: column !important; position: absolute !important;
    bottom: 40px !important; /* RESTORED: Back to the bottom of the screen */
    left: 20px !important; width: calc(100% - 40px) !important; max-width: 420px !important; z-index: 2000 !important;
    
    max-height: 90vh !important; /* Lets the card be as big as it needs to be */
    overflow-y: auto !important;

    /* Neumorphic Glassmorphism */
    background: rgba(15, 15, 18, 0.75) !important; 
    backdrop-filter: blur(24px) saturate(180%) !important;
    
    /* Hardware Lighting */
    border: 1px solid rgba(255, 255, 255, 0.05) !important; 
    border-top: 1px solid rgba(255, 255, 255, 0.15) !important; 
    border-radius: 24px !important; padding: 24px !important;
    box-shadow: 0 24px 50px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.05) !important; 
    
    transition: left 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease !important;
}

/* Custom Scrollbar for the Location Card on Desktop */
#location-card::-webkit-scrollbar { width: 4px; }
#location-card::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.3); border-radius: 10px; }
#location-card::-webkit-scrollbar-track { background: transparent; }

/* --- DYNAMIC SEARCH BAR SHIFT (DESKTOP) --- */
/* When the card opens, the search bar smoothly slides right and shrinks */
@media screen and (min-width: 769px) {
    .search-container {
        transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), left 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }
    body.card-open .search-container {
        left: 480px !important; /* Slides right to clear the card */
        transform: none !important;
        width: calc(100% - 520px) !important; /* Shrinks to fill remaining space */
        max-width: 600px !important;
    }
    body.card-open .search-container:focus-within {
        width: calc(100% - 520px) !important; 
    }
}

/* Add Spring Physics to all interactive buttons */
.icon-toggle, .icon-btn, .search-pill button, .widget-btn, #fav-btn, #share-btn {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                background 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease !important;
}

/* Tactile Push-In Effect when clicked */
.icon-toggle:active, .icon-btn:active, .search-pill button:active, .widget-btn:active, #fav-btn:active, #share-btn:active {
    transform: scale(0.92) !important; 
}

#location-card .photo-carousel {
    display: flex !important; flex-direction: row !important; gap: 10px !important; overflow-x: auto !important;
    margin: 18px 0 !important; padding-bottom: 8px !important; scrollbar-width: none !important;
}
#location-card .photo-carousel::-webkit-scrollbar { display: none !important; }
#location-card .photo-carousel img {
    width: 130px !important; height: 85px !important; object-fit: cover !important; border-radius: 8px !important;
    flex-shrink: 0 !important; border: 1px solid rgba(255, 255, 255, 0.1) !important; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
}

/* 7. Inputs & Checkboxes */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; background: transparent; outline: none; margin: 6px 0; }
input[type="range"]::-webkit-slider-runnable-track { width: 100%; height: 2px; cursor: pointer; background: rgba(255, 255, 255, 0.15); border-radius: 1px; border: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; height: 14px; width: 14px; border-radius: 50%; background: #ffffff; border: none; cursor: pointer; margin-top: -6px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1); }
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.2); }

/* 8. Map Pins, Route Glow & UI Overrides */
.leaflet-tile-pane { 
    /* Keeps it monochrome, but restores the brightness so roads and terrain are visible */
    filter: grayscale(100%) brightness(1.0) contrast(1.1) !important; 
}

/* 9. User GPS Location Marker */
.user-location-marker {
    background: #ffffff !important; border: 3px solid #00f0ff !important; border-radius: 50% !important;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.8) !important; position: relative;
}
.user-location-marker::after {
    content: ''; position: absolute; top: -12px; left: -12px; right: -12px; bottom: -12px;
    border: 2px solid #00f0ff; border-radius: 50%; animation: gps-pulse 2s infinite ease-out;
}
@keyframes gps-pulse { 0% { transform: scale(0.4); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
body:not(.map-active) .user-location-marker { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; transition: opacity 0.5s ease, visibility 0.5s ease; }


/* ========================================================= */
/* --- THE FIX: HIDE MAIN UI UNTIL LOGGED IN --- */
/* ========================================================= */
body:not(.logged-in) .hero-overlay,
body:not(.logged-in) .search-container {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.hero-overlay, .search-container {
    transition: opacity 0.6s ease, visibility 0.6s ease, transform 0.6s ease;
}

/* ========================================================= */
/* --- APPLE GLASSMORPHISM LOGIN WIDGET --- */
/* ========================================================= */
#login-card {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 340px;
    background: rgba(30, 30, 35, 0.5); backdrop-filter: blur(24px) saturate(200%); -webkit-backdrop-filter: blur(24px) saturate(200%); 
    border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 24px; padding: 32px 24px; z-index: 6000;
    box-shadow: 0 24px 48px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1); text-align: center;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

body.logged-in #login-card { opacity: 0; pointer-events: none; transform: translate(-50%, -55%) scale(0.95); }

.widget-title { font-size: 26px; font-weight: 700; color: #ffffff; margin: 0 0 4px 0; letter-spacing: 0.5px; }
.widget-subtitle { font-size: 13px; color: rgba(255, 255, 255, 0.5); margin-bottom: 24px; font-weight: 500; }
.widget-input { width: 100%; background: rgba(0, 0, 0, 0.2); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 14px 16px; color: #ffffff; margin-bottom: 12px; outline: none; font-size: 14px; transition: border 0.3s ease, background 0.3s ease; }
.widget-input:focus { border-color: rgba(255, 255, 255, 0.4); background: rgba(0, 0, 0, 0.4); }
.widget-input::placeholder { color: rgba(255, 255, 255, 0.3); }
.widget-btn { width: 100%; background: #ffffff; color: #000000; border: none; padding: 14px; border-radius: 12px; font-weight: 600; font-size: 15px; cursor: pointer; margin-top: 8px; transition: transform 0.2s ease, opacity 0.2s ease; }
.widget-btn:hover { opacity: 0.9; transform: scale(0.98); }

.forgot-pass-container { text-align: right; margin-bottom: 16px; margin-top: -4px; }
.forgot-pass-link { color: rgba(255, 255, 255, 0.5); font-size: 12px; text-decoration: none; transition: color 0.2s ease; }
.forgot-pass-link:hover { color: #ffffff; }

@keyframes input-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.input-shake { animation: input-shake 0.4s ease; }

.divider { display: flex; align-items: center; text-align: center; margin: 20px 0; color: rgba(255, 255, 255, 0.3); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.divider span { padding: 0 10px; }

.google-btn { width: 100%; background: rgba(255, 255, 255, 0.05); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.15); padding: 12px; border-radius: 12px; font-weight: 600; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: background 0.2s ease, transform 0.2s ease; }
.google-btn:hover { background: rgba(255, 255, 255, 0.1); transform: scale(0.98); }

.widget-footer { margin-top: 20px; font-size: 13px; color: rgba(255, 255, 255, 0.5); }
.widget-footer a { color: #ffffff; text-decoration: none; font-weight: 600; }

/* --- TOGGLE SWITCH UI --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: #888;
    transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .toggle-slider {
    background-color: rgba(0, 240, 255, 0.2);
    border-color: rgba(0, 240, 255, 0.4);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(14px);
    background-color: #00f0ff;
}

/* --- Dropdown List Items (Favorites) --- */
.history-item {
    color: rgba(255, 255, 255, 0.85) !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 12px;
    display: block;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
    margin-bottom: 4px;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #00f0ff !important;
}

/* --- PREMIUM HARDWARE BUTTON PHYSICS --- */
#start-route-btn {
    display: block; 
    width: 100%; 
    padding: 16px 0; 
    background: #00f0ff; 
    color: #000000; 
    border-radius: 16px; 
    text-align: center; 
    text-decoration: none; 
    font-weight: 900; 
    font-size: 14px; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    
    /* Simulate light hitting the top edge of a physical plastic button */
    box-shadow: 0 12px 24px rgba(0, 240, 255, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.6);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

#start-route-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(0, 240, 255, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.8);
}

#start-route-btn:active {
    transform: scale(0.96) translateY(2px);
    box-shadow: 0 4px 12px rgba(0, 240, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Subtle Text Selection Highlighting */
::selection {
    background: rgba(0, 240, 255, 0.3);
    color: #ffffff;
}

/* ========================================================= */
/* --- MICRO-UI & LOADING POLISH --- */
/* ========================================================= */

/* 1. Global Initialization Screen */
#global-loader {
    position: fixed; inset: 0; background: #0a0a0c; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s;
}
#global-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* Custom Minimalist Spinner */
.marga-spinner {
    width: 40px; height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid #00f0ff;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.loader-text {
    color: #555; font-size: 10px; font-weight: 800; letter-spacing: 4px;
    text-transform: uppercase; margin-top: 24px;
    animation: textPulse 1.5s ease-in-out infinite;
}
@keyframes textPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; color: #00f0ff; } }

/* 2. Skeleton Shimmer Effect (For Images & Text) */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}
.skeleton-box {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.02);
}

/* ========================================================= */
/* --- 9. GLOBAL MINIMALISM --- */
/* ========================================================= */

/* Minimalist Toolbar Elements */
.icon-btn {
    border: none !important;
    background: transparent !important;
    color: #888;
    transition: color 0.3s ease;
    cursor: pointer; /* Added this so users know it's clickable */
}

.icon-btn:hover {
    color: #fff;
}

/* Refined Search Pill */
.search-pill {
    background: #0a0a0a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 8px 16px;
    /* Change this from 8px to 50px for a perfect pill shape */
    border-radius: 50px; 
}

/* Minimalist Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* --- MOBILE RESPONSIVENESS BREAKPOINT (Phones) --- */
@media screen and (max-width: 768px) {
    
/* 1. TOP NAV ZONE (Ultra-Compact & Radar Safe) */
    #top-toolbar {
        position: fixed !important;
        top: 12px !important;
        left: 8px !important;
        right: 8px !important;
        width: calc(100% - 16px) !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 2px !important; /* Micro-gap to save space */
        padding: 0 !important;
        z-index: 2500 !important;
        overflow-x: visible !important;
    }

    /* Hide ALL toolbar groups on mobile — hamburger handles them */
    #top-toolbar .toolbar-group:nth-child(1),
    #top-toolbar .toolbar-group:nth-child(2),
    #top-toolbar .toolbar-group:nth-child(3) {
        display: none !important;
    }

    /* Profile — fixed to top right */
    #profile-avatar {
        position: fixed !important;
        top: 12px !important;
        right: 12px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 14px !important;
        z-index: 2500 !important;
        cursor: pointer;
    }
    #map-pill-name { display: none !important; }

    /* Show hamburger button on the left — map only */
    #mobile-controls-btn {
        display: flex !important;
        left: 12px !important;
        transform: none !important;
    }
    body.gateway-active #mobile-controls-btn,
    body.gateway-active #mobile-sheet-backdrop,
    body.gateway-active #mobile-controls-sheet {
        display: none !important;
    }

    /* Keep the profile circle tight but scaled appropriately */
    #profile-avatar {
        width: 30px !important;
        height: 30px !important;
        font-size: 12px !important;
        flex-shrink: 0 !important; /* Prevent iOS from squashing it */
        margin-left: 2px !important;
    }

    /* 2. SEARCH BAR ZONE (Anchored to the bottom) */
    #search-container {
        position: fixed !important;
        top: auto !important;       /* Kills the top positioning */
        bottom: 32px !important;    /* Pins it right above the screen edge */
        left: 12px !important;
        right: 12px !important;
        width: calc(100% - 24px) !important;
        transform: none !important;
        z-index: 2400 !important;   /* This ensures the Location Card (3000) slides smoothly over it */
    }
    
    .search-pill {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 3. BOTTOM SHEET ZONE (The Location Card) */
    #location-card {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 60vh !important; /* Only take up 60% of the screen */
        overflow-y: auto !important;
        border-radius: 24px 24px 0 0 !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-bottom: none !important;
        padding: 24px 20px 40px 20px !important; /* Extra bottom padding for iOS home bar */
        background: #0d0e12 !important; /* Solid dark background */
        z-index: 3000 !important; /* Float above absolutely everything */
        box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.8) !important;
        box-sizing: border-box;
        animation: slideUp 0.3s cubic-bezier(0.1, 0.76, 0.55, 0.94) forwards;
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Make the Start Route button sticky so it's always accessible */
    #start-route-btn {
        position: sticky;
        bottom: 0;
        margin-top: 24px;
        z-index: 3010;
        box-shadow: 0 -10px 20px #0d0e12; /* Fades the background behind it */
    }

    .photo-carousel {
        height: 100px !important;
        min-height: 100px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        display: flex !important;
        align-items: stretch !important;
        flex-shrink: 0 !important;
    }
    .photo-carousel img {
        width: 140px !important;
        height: 100px !important;
        min-height: 100px !important;
        object-fit: cover !important;
        flex-shrink: 0 !important;
    }

    /* 4. MOBILE QUESTIONNAIRE OVERRIDES */
    #questionnaire-card {
        padding: 32px 20px !important; 
        width: 92% !important;
        max-height: 85vh;
        overflow-y: auto; 
        border-radius: 20px !important;
        box-sizing: border-box;
    }

    #questionnaire-card h2 { font-size: 24px !important; }
    #questionnaire-card p { font-size: 14px !important; margin-bottom: 24px !important; }

    .mcq-group { gap: 8px; margin-bottom: 24px !important; }
    
    .mcq-option {
        flex: 1 1 100%; /* Force buttons to stack full width */
        text-align: center;
        padding: 14px !important;
        font-size: 14px;
    }
}

/* --- THE SEAMLESS AUTH MODAL --- */
#auth-modal {
    position: absolute; 
    top: 50%; left: 50%; 
    transform: translate(-50%, -50%); 
    
    background: rgba(30, 30, 35, 0.5); 
    backdrop-filter: blur(24px) saturate(200%); 
    -webkit-backdrop-filter: blur(24px) saturate(200%); 
    border: 1px solid rgba(255, 255, 255, 0.15); 
    border-radius: 24px; 
    z-index: 6000;
    box-shadow: 0 24px 48px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1); 
    
    /* Smooth width/height morphing */
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
                height 0.4s cubic-bezier(0.25, 1, 0.5, 1),
                opacity 0.5s ease, transform 0.5s ease;
    
    overflow: hidden; 
}

body.logged-in #auth-modal { 
    opacity: 0 !important; 
    pointer-events: none !important; 
    transform: translate(-50%, -55%) scale(0.95) !important; 
}

.auth-view {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    padding: 32px 24px; 
    transition: opacity 0.3s ease; /* Only fade opacity here */
    pointer-events: none;
}

.auth-view.active-view {
    opacity: 1;
    visibility: visible;
    position: relative; 
    pointer-events: auto;
}

#login-step { width: 340px; }
#questionnaire-step { width: 420px; }

/* --- QUICK SEARCH CHIPS --- */
.quick-search-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 4px;
    padding-left: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 4001;
}

.quick-search-chips::-webkit-scrollbar { 
    display: none; 
}

.chip-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a0a0a5;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chip-btn:hover, .chip-btn:active {
    background: rgba(0, 240, 255, 0.1);
    border-color: #00f0ff;
    color: #00f0ff;
    transform: scale(0.95);
}

/* --- SEARCH BAR (Perfectly Even Gaps) --- */
.search-pill {
    display: flex;
    align-items: center;
    background: rgba(15, 15, 15, 0.9); /* Adjust to your specific dark color */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    /* This padding is the secret: 6px top, 6px right, 6px bottom, 20px left */
    padding: 6px 6px 6px 20px; 
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

#search-btn {
    width: 38px; /* Fixed width/height guarantees a perfect circle */
    height: 38px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    margin: 0; /* Strip away any accidental margins causing unevenness */
    background: #00f0ff;
    color: #000;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

#search-bar {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 15px;
    outline: none;
    padding-right: 12px;
}

/* --- MARGA LANDING PAGE STYLES --- */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 24;
}

/* Background textures */
.bg-topographic {
    background-image: url("https://www.transparenttextures.com/patterns/topography.png");
    background-size: 400px 400px;
}
.volumetric-spotlight {
    background: radial-gradient(circle at 30% 20%, rgba(40, 60, 80, 0.15) 0%, rgba(20, 30, 40, 0.05) 40%, rgba(0, 0, 0, 0) 70%);
    mix-blend-mode: screen;
}

/* Glass Materials */
.glass-panel-search {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(48px) saturate(180%);
    -webkit-backdrop-filter: blur(48px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}
.glass-button {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 0.5px solid rgba(255, 255, 255, 0.15);
}

/* Image masks and glow */
.oled-glow { text-shadow: 0 0 40px rgba(255, 255, 255, 0.15); }
.feathered-card {
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.image-gradient-overlay {
    background: linear-gradient(to top, rgba(5,5,7,1) 0%, rgba(5,5,7,0.6) 50%, rgba(5,5,7,0) 100%);
}

/* --- RESULT COUNT LABEL --- */
#result-count-label {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5001;
    font-family: 'JetBrains Mono', monospace;
    color: #00f0ff;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 20px;
    padding: 6px 16px;
}
#result-count-label.visible { opacity: 1; }
body.gateway-active #result-count-label { display: none !important; }