/* --- VARIABLES --- */
:root {
    --bg-glass: rgba(18, 18, 18, 0.95);
    --bg-nav: #000000;
    --primary: #00E5FF;
    --text-main: #ffffff;
    --text-sub: #9ca3af;
    --border: rgba(255, 255, 255, 0.1);
    --radius: 20px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --bottom-height: 60px;
}

body.light-mode {
    --bg-glass: rgba(255, 255, 255, 0.95);
    --bg-nav: #ffffff;
    --primary: #2563eb;
    --text-main: #111827;
    --text-sub: #6b7280;
    --border: rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    /* Dynamic viewport height for modern browsers */
    font-family: 'Outfit', sans-serif;
    background: var(--bg-nav);
    overflow: hidden;
    color: var(--text-main);
    transition: background 0.3s;
}

/* --- INVITE WALL --- */
.invite-wall {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-nav);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 20px;
}

.invite-content {
    background: var(--bg-glass);
    padding: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 450px;
    width: 100%;
    animation: fadeIn 0.4s;
}

.invite-content.hidden {
    display: none !important;
}

/* --- MAP --- */
#map {
    position: fixed;
    /* Force full viewport coverage */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: #222;
}

.leaflet-control-attribution {
    display: none;
}

/* --- MARKERS --- */
.custom-pin {
    background-color: var(--primary);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 10px var(--primary);
    transition: transform 0.3s var(--ease);
}

.custom-pin:hover {
    transform: scale(1.3);
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* --- BOTTOM NAV --- */
/* --- BOTTOM NAV (FLOATING ISLAND) --- */
.bottom-nav {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    height: 60px;
    background: rgba(18, 18, 18, 0.85);
    /* Slightly more opaque */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 30px;
    /* Pill shape */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    z-index: 1000;
    padding: 0 10px;
}

/* Light mode adjustment */
body.light-mode .bottom-nav {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    background: none;
    border: none;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0 10px;
    height: 100%;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}

/* Add indicator dot for active state instead of full color change maybe? No, let's stick to color */
.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 5px;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
}

.nav-btn i {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-btn:active {
    transform: scale(0.95);
}

/* --- DRAWER (HIDDEN BY DEFAULT) --- */
/* --- DRAWER --- */
#drawer {
    position: absolute;
    /* Sit above the floating nav (20px bottom + 60px height + 10px gap) */
    bottom: calc(90px + env(safe-area-inset-bottom));
    left: 0;
    width: calc(100% - 20px);
    left: 10px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    z-index: 500;

    /* HIDDEN STATE */
    transform: translateY(120vh);
    /* Move completely off screen */
    visibility: hidden;
    transition: transform 0.4s var(--ease), visibility 0s linear 0.4s;

    display: flex;
    flex-direction: column;
    max-height: 75vh;
}

/* OPEN STATE CLASS */
#drawer.is-open {
    transform: translateY(0);
    visibility: visible;
    transition: transform 0.4s var(--ease), visibility 0s linear 0s;
}

@media (min-width: 768px) {
    #drawer {
        width: 400px;
        left: 20px;
        bottom: 100px;
        /* Fixed spacing on desktop */
        border-radius: var(--radius);
        border: 1px solid var(--border);
    }
}

.drawer-handle {
    width: 40px;
    height: 4px;
    background: var(--text-sub);
    border-radius: 2px;
    margin: 12px auto;
    opacity: 0.3;
    flex-shrink: 0;
}

.view-section {
    padding: 0 20px 20px;
    overflow-y: auto;
    display: none;
    animation: fadeIn 0.3s;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- CARDS & UI --- */
.horizontal-scroller {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-behavior: smooth;
}

.horizontal-scroller::-webkit-scrollbar {
    display: none;
}

.mini-card {
    min-width: 130px;
    height: 160px;
    background: rgba(127, 127, 127, 0.1);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    border: 1px solid var(--border);
    transition: 0.2s;
}

.mini-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.mini-card span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 8px 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn {
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-glass {
    background: rgba(127, 127, 127, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

input,
textarea {
    width: 100%;
    background: rgba(127, 127, 127, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px;
    border-radius: 10px;
    font-family: inherit;
    margin-bottom: 10px;
}

.toast {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: 0.3s;
    z-index: 2000;
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 5px;
    border-radius: 12px;
    background: rgba(127, 127, 127, 0.1);
    border: 1px solid var(--border);
    color: var(--text-sub);
    cursor: pointer;
    transition: 0.2s;
}

.type-btn:active {
    transform: scale(0.95);
}

.type-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.type-btn i {
    font-size: 1.1rem;
}

.amenity-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.amenity-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(127, 127, 127, 0.1);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
}

.amenity-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.amenity-tag {
    background: rgba(127, 127, 127, 0.15);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.type-btn span {
    font-size: 0.65rem;
    text-align: center;
}

.btn-float {
    position: absolute;
    /* Above drawer/nav area */
    bottom: calc(100px + env(safe-area-inset-bottom));
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--bg-glass);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 400;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s var(--ease);
}

.btn-float:active {
    transform: scale(0.95);
}

.hidden {
    display: none !important;
}

/* --- CLUSTERS --- */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(0, 229, 255, 0.6);
    /* Primary with opacity */
    border-radius: 50%;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 50%;
    font-weight: 600;
    color: white;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.marker-cluster-medium {
    background-color: rgba(251, 191, 36, 0.6);
    /* Amber */
}

.marker-cluster-medium div {
    background-color: #f59e0b;
}

.marker-cluster-large {
    background-color: rgba(244, 63, 94, 0.6);
    /* Rose */
}

.marker-cluster-large div {
    background-color: #e11d48;
}

/* --- TOAST --- */
.toast {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-glass);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 30px;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    font-weight: 500;
    font-size: 0.9rem;
}

/* --- FILTER UI --- */
.filter-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.filter-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(127, 127, 127, 0.1);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
}

.filter-btn:hover {
    background: rgba(127, 127, 127, 0.2);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}