/* ===========================================================
   1. GLOBAL VARIABLES & RESET
   =========================================================== */
:root {
    --primary-color: #333;
    --accent-color: #007AFF; /* Apple style blue */
    --bg-glass: rgba(255, 255, 255, 0.85);
    --shadow-main: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius-lg: 14px;
    --radius-md: 8px;
    --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background-color: #e5e5e5;
}

/* ===========================================================
   2. MAP CONTAINER
   =========================================================== */
#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 1;
}

/* ===========================================================
   3. MAP CONTROLS (MODE SWITCHER)
   =========================================================== */
.map-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    background: var(--bg-glass);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    padding: 4px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-main);
    display: flex;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.map-controls button {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    border-radius: 10px;
    color: #444;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.2px;
}

.map-controls button:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #000;
}

.map-controls button.active {
    background: #ffffff;
    color: var(--accent-color);
    box-shadow: var(--shadow-sm);
}

/* ===========================================================
   4. MAPLIBRE UI OVERRIDES (ZOOM & GPS BUTTONS)
   =========================================================== */
/* Navigatsiya va GPS tugmalarini chiroyli qilish */
.maplibregl-ctrl-group {
    border-radius: var(--radius-lg) !important;
    border: none !important;
    box-shadow: var(--shadow-main) !important;
    background: var(--bg-glass) !important;
    backdrop-filter: blur(10px) !important;
    overflow: hidden;
}

.maplibregl-ctrl-group button {
    width: 44px !important;
    height: 44px !important;
    background-color: transparent !important;
}

.maplibregl-ctrl-group button:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

/* ===========================================================
   5. CUSTOM POPUP STYLING
   =========================================================== */
.maplibregl-popup-content {
    border-radius: var(--radius-lg) !important;
    padding: 15px !important;
    box-shadow: var(--shadow-main) !important;
    background: var(--bg-glass) !important;
    backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--primary-color);
}

.maplibregl-popup-close-button {
    font-size: 20px;
    padding: 5px 10px;
    color: #999;
}

.maplibregl-popup-close-button:hover {
    color: #333;
    background: transparent;
}

.maplibregl-popup-tip {
    border-top-color: var(--bg-glass) !important;
}

/* ===========================================================
   6. RESPONSIVE DESIGN
   =========================================================== */
@media (max-width: 600px) {
    .map-controls {
        top: auto;
        bottom: 40px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        justify-content: center;
    }
    
    .map-controls button {
        flex: 1;
        padding: 12px 0;
    }

    .maplibregl-ctrl-bottom-right {
        bottom: 100px !important; /* Tugmalar Mode Switcher ustida tursin */
    }
}

/* ===========================================================
   7. UTILITIES
   =========================================================== */
.hidden { display: none; }

/* Pulsatsiya effekti (Joylar tanlanganda ishlatish uchun) */
@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(0, 122, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 122, 255, 0); }
}


.map-loader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #f8f9fa; z-index: 1000; display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s;
}
.map-loader.hidden { opacity: 0; pointer-events: none; }
.spinner {
    width: 40px; height: 40px; border: 4px solid #f3f3f3;
    border-top: 4px solid #007AFF; border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Tugma ichidagi ikonka uchun */
.map-controls button { display: flex; align-items: center; gap: 8px; }

/* style.css ga qo'shing */

/* Popup karta stili */
.popup-card {
    min-width: 200px;
    font-family: var(--font-main);
}

.popup-header {
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.category-tag {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.popup-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--primary-color);
}

.popup-body p {
    margin: 4px 0;
    font-size: 13px;
    color: #666;
}

.popup-footer {
    margin-top: 12px;
}

.popup-footer button {
    width: 100%;
    padding: 8px;
    background: #f0f0f0;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.popup-footer button:hover {
    background: var(--accent-color);
    color: white;
}

/* 2D/3D Controls (Eski controls yonida turadi) */
.view-controls {
    position: absolute;
    top: 20px;
    left: 250px; /* Birinchi paneldan keyin joylashadi */
    z-index: 10;
    background: var(--bg-glass);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    padding: 4px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-main);
    display: flex;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.view-controls button {
    padding: 10px 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    border-radius: 10px;
    color: #444;
    transition: 0.3s;
}

.view-controls button:hover { background: rgba(0,0,0,0.05); }

.view-controls button.active {
    background: #ffffff;
    color: var(--accent-color);
    box-shadow: var(--shadow-sm);
}

/* Mobil uchun moslashuv */
@media (max-width: 600px) {
    .view-controls {
        top: auto;
        bottom: 100px; /* Mode switcher tepasida */
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        justify-content: center;
    }
}