@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* { margin:0; padding:0; box-sizing:border-box; font-family:'Poppins',sans-serif; }
html, body {
    height:100%;
    width:100%;
    background:#000;
    overflow: hidden;
}

/* ==========================
   DARK MODE
========================== */
body.dark { background:#111; }
body.dark #search-bar input { background:#222; color:#fff; border:1px solid #444; }
body.dark #search-bar button { background:#960595; color:#fff; }
body.dark .navigation { background:#222; }
body.dark .navigation ul li a .text,
body.dark .navigation ul li a .icon { color:#fff; }

/* ==========================
   MAP & LAYOUT
========================== */
#main-content { position:relative; width:100%; height:100vh; }
#map { width:100%; height:100%; }

/* STREET VIEW BUTTON (if used) */
#streetview-btn {
    position:absolute;
    bottom:100px;
    left:20px;
    padding:10px 15px;
    background:#960595;
    color:#fff;
    border-radius:5px;
    cursor:pointer;
    z-index:1500;
}

/* ==========================
   SEARCH WRAPPER + MODE SWITCH - DESKTOP
========================== */
#search-wrapper {
    position:absolute;
    top:20px;
    left:50%;
    transform:translateX(-50%);
    width:80%;
    display:flex;
    align-items:center;
    gap:12px;
    z-index:3000;
}

#search-wrapper.hidden { display:none; }

#mode-switch {
    padding:10px 14px;
    background:#960595;
    color:#fff;
    border:none;
    border-radius:10px;
    cursor:pointer;
    font-size:14px;
    font-weight:600;
    white-space:nowrap;
    height:50px;
}

#mode-switch:hover { opacity:.85; }

/* ==========================
   SEARCH BAR - DESKTOP
========================== */
#search-bar {
    flex:1;
    display:flex;
    flex-direction:column;
    gap:10px;
    background:rgba(0,0,0,0.45);
    padding:16px;
    border-radius:16px;
    backdrop-filter:blur(8px);
}

.search-group { display:none; width:100%; }
.search-group.active { display:block; }

#search-bar input {
    width:100%;
    padding:12px;
    border-radius:10px;
    border:none;
    outline:none;
    font-size:14px;
    background:#fff;
}

#route-search {
    width:100%;
    padding:12px;
    background:#960595;
    color:#fff;
    border:none;
    border-radius:10px;
    font-size:16px;
    cursor:pointer;
}

#route-search:hover { opacity:.85; }

/* ==========================
   NAVIGATION BAR - DESKTOP
========================== */
.navigation {
    position:fixed;
    bottom:0;
    left:0;
    width:100%;
    height:70px;
    background:#960595;
    display:flex;
    justify-content:center;
    align-items:center;
    z-index:2000;
}

.navigation ul {
    display:flex;
    gap:40px;
    position:relative;
    padding:0 20px;
}

.navigation ul li {
    position:relative;
    width:70px;
    height:70px;
    list-style:none;
    z-index:1;
}

.navigation ul li a {
    display:flex;
    justify-content:center;
    align-items:center;
    flex-direction:column;
    width:100%;
    text-align:center;
}

/* IKON - DESKTOP */
.navigation ul li a .icon {
    font-size:1.6em;
    color:#fff;
    transition:.5s;
    line-height:normal;
    margin-left:40px;
    margin-top:6px;
}

.navigation ul li.active a .icon { transform:translateY(-32px); }

/* TEKS - DESKTOP */
.navigation ul li a .text {
    position:absolute;
    color:#fff;
    opacity:0;
    transform:translateY(20px);
    transition:.5s;
    font-size:.7em;
    margin-left:40px;
}
.navigation ul li.active a .text {
    opacity:1;
    transform:translateY(10px);
}

/* CIRCLE - DESKTOP */
.navigation ul li a .circle {
    position:absolute;
    width:50px;
    height:50px;
    left:30px;
    top:10px;
    border-radius:50%;
    border:1.8px solid #fff;
    transform:translateY(-37px) scale(0);
}

.navigation ul li.active a .circle {
    transform:translateY(-37px) scale(1);
    transition:.5s;
    transition-delay:.5s;
}

/* ==========================
   INDICATOR - DESKTOP
========================== */
.indicator {
    position:absolute;
    top:-55%;
    width:70px;
    height:70px;
    background:#960595;
    border:6px solid #000;
    border-radius:50%;
    transition:transform .35s ease;
}

.navigation ul li:nth-child(1).active ~ .indicator { transform:translateX(0); }
.navigation ul li:nth-child(2).active ~ .indicator { transform:translateX(110px); }
.navigation ul li:nth-child(3).active ~ .indicator { transform:translateX(220px); }

/* ==========================
   ROUTING PANEL - DESKTOP
========================== */
#routing-wrapper {
    position: absolute;
    top: 80px;
    right: 16px;
    z-index: 4000;
    pointer-events: auto;
    max-width: 380px;
    transition: transform 0.3s ease-in-out;
}

#routing-wrapper .leaflet-routing-container {
    width: 100%;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    border-radius: 10px;
    overflow: hidden;
}

/* ==========================
   ROUTING TOGGLE BUTTON - Hidden on Desktop & Initially Hidden
========================== */
#routing-toggle {
    display: none;
    position: fixed;
    right: 16px;
    top: 120px;
    z-index: 4001;
    background: #960595;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

#routing-toggle:hover {
    background: #7a0475;
    transform: scale(1.1);
}

#routing-toggle:active {
    transform: scale(0.95);
}

/* ==========================
   ROUTING OVERLAY - Hidden on Desktop
========================== */
.routing-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.routing-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ==========================
   COORDINATE BOX - DESKTOP
========================== */
#coord-box {
    position: fixed;
    right: 12px;
    bottom: 90px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 3000;
}

/* ==========================
   COORD POPUP
========================== */
#coord-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 5000;
    display: none;
}
#coord-popup.show { display:block; }
.coord-popup-content {
    background: #fff;
    color: #000;
    padding: 18px;
    border-radius: 10px;
    min-width: 240px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

/* ==========================
   DISTANCE BOX - DESKTOP
========================== */
#distance-box {
    position: fixed;
    left: 16px;
    bottom: 90px;
    z-index: 3500;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 12px;
    border-radius: 10px;
    min-width: 180px;
}

#distance-box.hidden {
    display: none;
}

/* ==========================
   CENTER POINTER
========================== */
#center-pointer {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: 2px solid #960595;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    display: none;
}

/* ==========================
   SETTINGS POPUP - DESKTOP
========================== */
#settings-popup {
    position: fixed;
    right: 16px;
    bottom: 90px;
    z-index: 4500;
    display: none;
}
#settings-popup.show { display:block; }
#settings-popup .popup-content {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

/* ==========================
   MOBILE RESPONSIVE
========================== */
@media (max-width: 768px) {
    html, body { overflow: hidden; }

    /* SEARCH WRAPPER - MOBILE */
    #search-wrapper {
        top: 10px;
        width: 95%;
        flex-direction: column;
        gap: 8px;
        padding: 0 5px;
    }

    #mode-switch { 
        width: 100%; 
        font-size: 16px; 
        padding: 12px 0; 
        border-radius: 12px; 
    }

    /* SEARCH BAR - MOBILE */
    #search-bar { 
        width: 100%; 
        padding: 12px; 
        gap: 8px; 
        border-radius: 12px; 
    }
    
    #search-bar input, #route-search { 
        font-size: 16px; 
        padding: 10px; 
    }
    
    #route-search { 
        margin-top: 5px; 
    }

    /* MAP - MOBILE */
    #map { 
        height: calc(100vh - 120px); 
    }

    /* NAVIGATION BAR - MOBILE */
    .navigation { 
        height: 120px; 
    }

    .navigation ul li a .icon {
        margin-left: 30px;
        margin-top: 10px;
        font-size: 1.8em;
        line-height: normal;
    }

    .navigation ul li a .circle {
        width: 50px;
        height: 50px;
        left: 25px;
        top: 8px;
    }

    .navigation ul li a .text {
        font-size: 0.8em;
        transform: translateY(25px);
    }

    /* INDICATOR - MOBILE */
    .indicator {
        width: 60px;
        height: 60px;
        top: -55%;
        border-width: 5px;
    }

    /* ROUTING TOGGLE - MOBILE: SHOW ONLY WHEN NEEDED */
    #routing-toggle {
        /* Will be shown via JavaScript when route exists */
        display: none;
        align-items: center;
        justify-content: center;
        top: 140px;
    }

    /* ROUTING WRAPPER - MOBILE: SLIDE FROM RIGHT */
    #routing-wrapper {
        position: fixed;
        top: 200px;
        right: 0;
        left: auto;
        width: 90%;
        max-width: 360px;
        transform: translateX(calc(100% + 16px));
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -4px 0 12px rgba(0,0,0,0.2);
    }

    /* When visible, slide in */
    #routing-wrapper.visible {
        transform: translateX(0);
    }

    /* Adjust routing container for mobile */
    #routing-wrapper .leaflet-routing-container {
        max-height: calc(100vh - 320px);
        overflow-y: auto;
        border-radius: 10px 0 0 10px;
    }

    /* DISTANCE BOX - MOBILE */
    #distance-box {
        left: 16px;
        bottom: 140px;
    }

    /* COORDINATE BOX - MOBILE */
    #coord-box {
        right: 12px;
        bottom: 140px;
    }

    /* SETTINGS POPUP - MOBILE */
    #settings-popup {
        right: 16px;
        bottom: 140px;
    }
}