:root {
    --primary: #FF4D4D;
    --primary-hover: #ff3333;
    --bg-color: #000000;
    --card-bg: #141416;
    --text-color: #ffffff;
    --text-muted: #8E8E93;
    --glass-bg: rgba(20, 20, 22, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 32px;
    --shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.5);
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden; 
    overscroll-behavior-y: none; /* Prevents pull-to-refresh on mobile */
}

h1, h2, h3, .logo {
    font-family: 'Outfit', sans-serif;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    position: relative;
}

.highlight {
    color: var(--primary);
}

.hidden {
    display: none !important;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

/* --- Top Search Bar --- */
.top-bar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    height: 64px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    border-radius: 100px;
    box-shadow: var(--shadow);
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-right: 20px;
}

.search-bar {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1rem;
}

.search-bar input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--text-color);
    padding: 12px 16px 12px 42px;
    border-radius: 100px;
    outline: none;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.filter-dropdown {
    background: rgba(0,0,0,0.7);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    padding: 8px 12px;
    margin-left: 6px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    max-width: 90px;
}

.search-bar .btn {
    margin-left: 6px;
    border-radius: 100px;
    padding: 8px 14px;
}

.desktop-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

/* --- Map Container --- */
.map-container {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #111;
    z-index: 1;
}

/* --- FAB (Floating Action Button) --- */
.fab {
    position: absolute;
    bottom: 100px; /* Above bottom nav */
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    transition: transform 0.2s, background 0.2s;
}

.fab:active {
    transform: scale(0.9);
}

.glass-fab {
    background: rgba(20, 20, 22, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.glass-fab:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* --- Bottom Navigation (Mobile) --- */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(70px + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-bottom: none;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    width: 60px;
}

.nav-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.nav-item.active {
    color: white;
}

.nav-item.active i {
    color: var(--primary);
}

/* --- Buttons --- */
.btn {
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1.1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 15px rgba(255, 77, 77, 0.4);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--glass-border);
    color: white;
}
.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.btn-block {
    width: 100%;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-close-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.btn-close-icon:hover {
    background: rgba(255,255,255,0.2);
}

/* --- Modals & Bottom Sheets --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.glass-modal {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.modal-overlay.hidden .glass-modal {
    transform: scale(0.95);
}

.glass-sheet {
    background: var(--card-bg);
    border-top: 1px solid var(--glass-border);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    position: absolute;
    bottom: 0;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.2, 1, 0.3, 1);
    padding-bottom: calc(24px + var(--safe-area-bottom));
}

.modal-overlay.hidden .glass-sheet {
    transform: translateY(100%);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    margin: 0 auto 20px;
}

.modal-content h3, .glass-sheet h3 {
    margin-bottom: 8px;
    font-size: 1.8rem;
    font-weight: 900;
}

.modal-subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

/* Marker Styles */
.custom-div-icon {
    background: transparent;
    border: none;
}

/* Forms */
.form-group {
    position: relative;
    margin-bottom: 16px;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

.input-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 16px;
    border-radius: var(--radius-md);
    outline: none;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-field.with-icon {
    padding-left: 48px;
}

.input-field:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

select.input-field {
    appearance: none;
    -webkit-appearance: none;
}

.auth-toggle {
    margin-top: 24px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.user-email-display {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

/* --- Leaflet Overrides --- */
.leaflet-container { font-family: 'Inter', sans-serif !important; }
.leaflet-popup-content-wrapper {
    background: rgba(20, 20, 22, 0.95) !important;
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: var(--text-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5) !important;
}
.leaflet-popup-tip { background: rgba(20, 20, 22, 0.95) !important; border: 1px solid var(--glass-border); }
.leaflet-popup-content { margin: 16px !important; line-height: 1.5; }

/* Video Popups */
.video-item { margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.video-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.video-title { font-weight: 700; margin-bottom: 8px; color: #fff; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.video-title:hover, .video-title.active { color: var(--primary); }
.video-category { font-size: 0.75rem; color: #fff; background: rgba(255,255,255,0.2); padding: 4px 8px; border-radius: 100px; margin-left: auto; font-weight: 600;}
.video-embed-container { margin-top: 10px; border-radius: 12px; overflow: hidden; background: #000; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.video-actions { margin-top: 12px; display: flex; justify-content: flex-end; }

/* --- Responsive Media Queries --- */
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    
    .top-bar {
        top: max(10px, env(safe-area-inset-top));
        height: auto;
        min-height: 56px;
        padding: 10px;
    }
    
    .logo {
        display: none; /* Hide logo to make room for search on mobile */
    }
    
    .search-bar {
        padding: 0;
        border: none;
        background: transparent;
    }
    
    .search-bar input {
        padding: 10px 12px 10px 36px;
        font-size: 0.9rem;
    }
    
    .search-icon {
        left: 12px;
    }

    .filter-dropdown {
        padding: 8px;
        max-width: 75px;
        font-size: 0.85rem;
    }
    
    .search-bar .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .fab {
        bottom: calc(90px + var(--safe-area-bottom));
    }
    
    .glass-modal {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        border: none;
        padding-top: max(60px, env(safe-area-inset-top));
    }
    
    .leaflet-control-zoom {
        display: none !important; /* Hide zoom controls on mobile, rely on pinch */
    }
}

@media (min-width: 769px) {
    .mobile-only { display: none !important; }
    
    .top-bar {
        border-radius: var(--radius-lg);
    }
}
