/* Back to Landing Button */
.back-to-landing {
    position: fixed;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.95);
    color: #0284c7;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.back-to-landing:hover {
    background: #0284c7;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.3);
}

.back-to-landing:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .back-to-landing {
        top: 0.5rem;
        left: 0.5rem;
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
}

/* Aurora / Mesh Gradient Background */
body {
    background-color: #f8fafc;
    /* Very light slate */
    min-height: 100vh;
    overflow: hidden;
    /* Prevent scrolling on body, map handles it */
}

.dark body {
    background-color: #0f172a;
    /* Slate 900 */
}

/* Abstract Aurora Orbs behind everything */
.aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.aurora-blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.6;
    border-radius: 50%;
    animation: floatOrb 20s ease-in-out infinite alternate;
}

.dark .aurora-blob {
    opacity: 0.4;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #38bdf8;
    animation-delay: 0s;
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: #818cf8;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 50%;
    width: 40vw;
    height: 40vw;
    background: #34d399;
    animation-delay: -10s;
    transform: translate(-50%, -50%);
}

.dark .blob-1 {
    background: #0284c7;
}

.dark .blob-2 {
    background: #4f46e5;
}

.dark .blob-3 {
    background: #059669;
}

@keyframes floatOrb {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(10%, -10%) scale(1.1);
    }

    66% {
        transform: translate(-5%, 15%) scale(0.9);
    }

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

/* Premium Glassmorphism Classes */
.glass-panel {
    background: rgba(255, 255, 255, 0.35);
    /* Lower opacity */
    backdrop-filter: blur(24px);
    /* Higher blur for frosted look */
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    /* Thicker/whiter border for edge lighting */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.dark .glass-panel {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 20px;
}

/* Map Styling - Full Screen Base */
#map-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Layout Structure Overlay */
.app-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through to map by default */
    display: flex;
    flex-direction: column;
}

.pointer-events-auto {
    pointer-events: auto;
    /* Re-enable clicks on floating panels */
}

/* Leaflet Popup Modernization */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.leaflet-popup-content {
    margin: 12px 16px;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
}

.dark .leaflet-popup-content-wrapper {
    background-color: #1e293b;
    color: #f8fafc;
}

.dark .leaflet-popup-tip {
    background-color: #1e293b;
}

/* Custom Marker Styles (CSS Icon) */
.custom-marker-pin {
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    background: #0ea5e9;
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -15px 0 0 -15px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

.custom-marker-pin::after {
    content: '';
    width: 14px;
    height: 14px;
    margin: 6px 0 0 6px;
    background: #fff;
    position: absolute;
    border-radius: 50%;
}

.dark .custom-marker-pin {
    border-color: #0f172a;
}

/* Active State */
.location-item.active {
    border-left: 4px solid #0ea5e9;
    background: rgba(14, 165, 233, 0.1);
}

.location-item {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.location-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* Floating Action Bar for Mobile */
.mobile-fab-container {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Modal Animation */
.modal-content {
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

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

/* Message Box Slide */
.message-box {
    transform: translateX(-50%) translateY(-150%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 9999;
}

.message-box.show {
    transform: translateX(-50%) translateY(20px);
    opacity: 1;
    pointer-events: auto;
}

/* MarkerCluster Customization */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(14, 165, 233, 0.6);
    /* Tailwind sky-500 with opacity */
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(2, 132, 199, 0.9);
    /* Tailwind sky-600 */
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
}

.dark .marker-cluster-small,
.dark .marker-cluster-medium,
.dark .marker-cluster-large {
    background-color: rgba(30, 41, 59, 0.8);
    /* Slate 800 */
}

.dark .marker-cluster-small div,
.dark .marker-cluster-medium div,
.dark .marker-cluster-large div {
    background-color: rgba(14, 165, 233, 0.9);
    /* Sky 500 */
}

/* Leaflet Routing Machine customizations */
.leaflet-routing-container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: #334155;
    font-family: 'Inter', sans-serif;
    margin-bottom: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

.dark .leaflet-routing-container {
    background-color: rgba(30, 41, 59, 0.9);
    color: #f8fafc;
}

.leaflet-routing-container table {
    color: inherit;
}

/* Mobile optimizations for routing box */
@media (max-width: 768px) {
    .leaflet-routing-container {
        max-height: 40vh;
        margin: 10px;
    }
}