/* Base Variables & Reset */
:root {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-color: #4f46e5;
    --accent-hover: #6366f1;
    --success-color: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    /* Prevent body scroll, layout handles it */
}

/* Glassmorphism Utility */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    padding: 0;
    margin: 0;
    max-width: 100%;
}

/* Header */
.app-header {
    border-radius: 0;
    padding: 1rem 2rem;
    /* Increased height further */
    display: flex;
    flex-direction: row;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.brand-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.brand-logo {
    max-height: 45px;
    object-fit: contain;
}

.brand-phone {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(79, 70, 229, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.3s;
}

.brand-phone:hover {
    background: rgba(79, 70, 229, 0.2);
}

.title-section {
    flex: 1;
    text-align: left;
}

.title-section h1 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0;
    background: linear-gradient(to right, #4f46e5, #9333ea);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.title-section p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 2px;
}

/* Category Band */
.category-band {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    overflow-x: auto;
}

.distinct-band {
    background: #1e293b;
    /* Dark distinct color */
    border-bottom: 1px solid #0f172a;
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    /* Horizontal scrolling band */
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.4);
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px -1px rgba(0, 0, 0, 0.03);
}

.distinct-band .category-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.distinct-band .category-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: translateY(-1px);
}

.distinct-band .category-btn.active {
    background: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
    color: var(--accent-color);
}

.category-btn.active {
    background: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.category-btn i {
    font-size: 1.1em;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

/* Map Section */
.map-section {
    flex: 1;
    height: 100%;
    position: relative;
    border-radius: 0;
    overflow: hidden;
}

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

/* Toggle List Button */
.toggle-list-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 900;
    padding: 10px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-list-btn:hover {
    background: #ffffff;
    transform: translateY(-2px);
    color: var(--accent-color);
}

/* Override Leaflet styles for Light Mode */
.leaflet-container {
    font-family: 'Inter', sans-serif;
}

.leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.9);
}

.leaflet-popup-content {
    font-weight: 600;
    margin: 14px 20px;
    font-size: 1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(79, 70, 229, 0.1);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* List Section */
.list-section {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-section.open {
    transform: translateX(0);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.list-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
}

.close-list-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-list-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.badge {
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent-color);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.search-box {
    margin-bottom: 1rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

.search-box input:focus {
    background: #ffffff;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.building-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Custom Scrollbar for the list */
.building-list::-webkit-scrollbar {
    width: 6px;
}

.building-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
}

.building-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.building-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

.building-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px -1px rgba(0, 0, 0, 0.03);
}

.building-item:hover {
    background: #ffffff;
    border-color: rgba(79, 70, 229, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
}

.building-icon {
    width: 36px;
    height: 36px;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: var(--accent-color);
}

.building-info {
    flex: 1;
}

.building-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.building-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: capitalize;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 900px) {
    .main-content {
        flex-direction: row;
    }

    .map-section {
        flex: 1;
        height: 100%;
    }

    .list-section {
        width: 100%;
        border-left: none;
    }
}

@media (max-width: 768px) {
    .d-none-mobile {
        display: none;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.5rem;
    }

    .brand-section {
        margin-bottom: 0.5rem;
    }

    .title-section h1 {
        font-size: 1.1rem;
    }
}

/* Marker Labels for Zoom-in */
.marker-label-tooltip {
    opacity: 0 !important;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    padding: 4px 8px;
    white-space: nowrap;
}

/* Override leaflet tooltip triangle to match or hide */
.leaflet-tooltip.marker-label-tooltip::before {
    border-right-color: rgba(255, 255, 255, 0.95);
}

.leaflet-container.show-marker-labels .marker-label-tooltip {
    opacity: 1 !important;
    visibility: visible;
}