/**
 * TOCHKA Map Interface Styles (v38.2.1)
 * Atmos Core: OLED Tracking & Cinema Clusters Engine
 * Sync: Distance Badges, Category Theming, Haptic UI
 * Revision: [2026-04-08] — Добавлена поддержка динамического VH для Mobile Safari.
 */

:root {
    --map-ui-speed: 0.6s cubic-bezier(0.32, 0.72, 0, 1);
    --accent-orange: #FF9500;
    --accent-blue: #007AFF;
    --accent-boost: #FFD700; /* Золото для BOOST */
    --cluster-bg: rgba(10, 10, 12, 0.9);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    
    /* Цвета категорий для синхронизации */
    --color-sport: #34C759;
    --color-party: #FF2D55;
    --color-food: #FF9500;
    --color-culture: #AF52DE;
    --color-default: #8E8E93;
}

/* 1. Глобальный Fullscreen Контейнер & Динамическая Высота */
.map-page-wrapper {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: #000;
    overflow: hidden;
    /* Фикс для мобильных браузеров */
    height: 100vh; 
    height: calc(var(--vh, 1vh) * 100); 
}

#app-main-map, #main-map {
    width: 100%;
    /* Фикс для мобильных браузеров */
    height: 100vh; 
    height: calc(var(--vh, 1vh) * 100);
    background: #000;
}

/* 2. OLED USER MARKER & LIVE POSITIONING */
.user-location-marker {
    width: 24px;
    height: 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-dot {
    width: 14px;
    height: 14px;
    background: var(--accent-blue);
    border: 2.5px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 122, 255, 0.8);
    z-index: 2;
}

.marker-pulse {
    position: absolute;
    width: 44px;
    height: 44px;
    background: rgba(0, 122, 255, 0.25);
    border-radius: 50%;
    z-index: 1;
    animation: markerPulse 2.5s infinite ease-out;
}

@keyframes markerPulse {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(2.8); opacity: 0; }
}

/* 3. КИНЕМАТОГРАФИЧНЫЕ МАРКЕРЫ (Single Points) */
.cinema-marker {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform;
}

/* Контейнер иконки */
.marker-content {
    width: 38px;
    height: 38px;
    background: #1a1a1c;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    z-index: 2;
    overflow: hidden;
}

/* Бейдж дистанции над маркером */
.marker-dist {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    z-index: 3;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Темы маркеров по категориям */
.cinema-marker.cat-sport .marker-content { border-color: var(--color-sport); }
.cinema-marker.cat-party .marker-content { border-color: var(--color-party); }
.cinema-marker.cat-food .marker-content { border-color: var(--color-food); }
.cinema-marker.cat-culture .marker-content { border-color: var(--color-culture); }

/* BOOST MARKER SPECIAL */
.cinema-marker.is-boost .marker-content {
    border-color: var(--accent-boost);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.cinema-marker.is-boost::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-boost);
    border-radius: 14px;
    opacity: 0.3;
    filter: blur(12px);
    animation: boostPulse 2s infinite ease-in-out;
}

@keyframes boostPulse {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}

/* 4. КИНЕМАТОГРАФИЧНЫЕ КЛАСТЕРЫ */
.cinema-cluster {
    position: relative;
    width: 52px; 
    height: 52px;
    background: var(--cluster-bg);
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    color: #fff; 
    font-weight: 800; 
    font-size: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px); 
    -webkit-backdrop-filter: blur(15px);
}

.cluster-glow {
    position: absolute; 
    inset: -4px;
    border-radius: 50%; 
    opacity: 0.4;
    filter: blur(12px); 
    z-index: -1;
    background: #fff;
}

/* Динамические цвета кластеров */
.cinema-cluster.cat-sport { border-color: var(--color-sport); }
.cinema-cluster.cat-sport .cluster-glow { background: var(--color-sport); }

.cinema-cluster.cat-party { border-color: var(--color-party); }
.cinema-cluster.cat-party .cluster-glow { background: var(--color-party); }

.cinema-cluster.cat-food { border-color: var(--color-food); }
.cinema-cluster.cat-food .cluster-glow { background: var(--color-food); }

/* 5. КАРТОВЫЕ ФИЛЬТРЫ (Overlay Chips) */
.map-filter-overlay {
    position: absolute; 
    top: calc(var(--safe-top) + 16px); 
    left: 0; right: 0; 
    z-index: 1000;
    pointer-events: none;
    transition: transform var(--map-ui-speed), opacity 0.4s ease;
}

.filter-scroll { 
    display: flex; 
    gap: 10px; 
    padding: 0 16px;
    pointer-events: auto; 
    overflow-x: auto;
    scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar { display: none; }

.chip {
    flex-shrink: 0; 
    background: rgba(28, 28, 30, 0.8) !important;
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding: 10px 18px !important; 
    border-radius: 16px !important;
    color: rgba(255, 255, 255, 0.9) !important; 
    font-size: 14px; 
    font-weight: 700; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chip.active { 
    background: #ffffff !important; 
    color: #000000 !important; 
    border-color: #ffffff !important;
    transform: scale(1.05);
}

/* 6. УПРАВЛЕНИЕ КАРТОЙ (Zoom & Locate) */
.map-controls { 
    position: absolute; 
    right: 16px; 
    bottom: calc(var(--tabbar-h, 72px) + 24px + var(--safe-bottom)); 
    z-index: 1000; 
    display: flex; 
    flex-direction: column; 
    gap: 14px;
    transition: transform var(--map-ui-speed), opacity 0.3s ease;
}

.map-fab {
    width: 56px; 
    height: 56px; 
    border-radius: 20px; 
    background: #fff;
    color: #000; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
    border: none; 
    outline: none;
}

.map-fab:active {
    transform: scale(0.92);
    background: #f2f2f7;
}

/* 7. STATES: MAP INTERACTING (Cinema Hide) */
.map-interacting .map-filter-overlay { 
    transform: translateY(-150%); 
    opacity: 0; 
}

.map-interacting .map-controls { 
    transform: translateX(100px); 
    opacity: 0; 
}

body.map-interacting .tabbar {
    transform: translateY(120%);
    opacity: 0;
}

/* 8. PRELOADER & FADE */
#map-preloader {
    position: absolute;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease;
}

.loader-ripple {
    width: 80px;
    height: 80px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}