/* map.css - Specifické styly pro interaktivní mapu */

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0a0a0c;
}

#map {
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* Glassmorphism základ */
.glassmorphism {
    background: rgba(20, 20, 25, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Horní lišta nad mapou */
.map-overlay-top {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 720px;
    z-index: 1000;
    pointer-events: none;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 18px;
    border-radius: 100px;
    pointer-events: auto;
    gap: 3px;
}

.map-back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.map-back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.map-filters {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px;
    border-radius: 50px;
}

.map-filter-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-filter-btn.active {
    background: var(--primary);
    color: #fff;
}

.map-actions {
    display: flex;
    gap: 8px;
}

#map-refresh-toggle[data-active="true"],
#map-cluster-toggle[data-active="true"],
#map-hide-zoc-toggle[data-active="true"] {
    color: #4dff91; /* Zelená barva při aktivním stavu */
}

/* Indikátor načítání */
.map-loading {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.map-loading.active {
    opacity: 1;
}

/* Postranní panel (Sidebar) pro detaily karet */
.map-sidebar {
    position: absolute;
    top: 20px;
    right: -450px; /* Skryto mimo obrazovku */
    width: 350px;
    height: calc(100vh - 40px);
    z-index: 1000;
    border-radius: 16px;
    transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.map-sidebar.open {
    right: 20px;
}

.sidebar-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

.sidebar-close:hover {
    color: var(--text-main);
}

.sidebar-content {
    margin-top: 10px;
}

/* Upravená kartička v sidebaru (abychom použili stávající styly .card ze style.css) */
.map-sidebar .card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    animation: none;
}
.map-sidebar .card:hover {
    transform: none;
    border-color: transparent;
    box-shadow: none;
}

/* Vzhled bodů na mapě (Leaflet) */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    font-size: 1.1rem;
    background: #333;
    transition: transform 0.2s;
    box-sizing: border-box;
    white-space: nowrap;
}

.custom-marker.multi-emoji {
    border-radius: 17px;
    font-size: 0.92rem;
    padding: 0 4px;
    gap: 1px;
}

.custom-marker:hover {
    transform: scale(1.1);
    z-index: 1000 !important;
}

.marker-hzs { background-color: rgba(255, 77, 77, 0.9); }
.marker-jsdi-nehoda { background-color: rgba(77, 121, 255, 0.9); }
.marker-jsdi-omezeni { background-color: rgba(255, 152, 0, 0.9); }
.marker-jsdi-pocasi { background-color: rgba(77, 158, 255, 0.9); }

/* Animace pulzování u nejnovějších */
.marker-recent {
    animation: markerPulse 2s infinite;
}

@keyframes markerPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 77, 77, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
}

/* MarkerCluster styly - úprava pro Dark Mode */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
    background-color: rgba(255, 77, 77, 0.4);
}
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
    background-color: rgba(255, 77, 77, 0.9);
    color: white;
    font-weight: 700;
}

/* Skrytí defaultních leaflet tlačítek +/- (zoom) a zobrazení vpravo dole */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
}
.leaflet-control-zoom a {
    background: rgba(20, 20, 25, 0.8) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,0.1) !important;
}
.leaflet-control-zoom a:hover {
    background: rgba(40, 40, 45, 0.9) !important;
}

/* Responzivita (Mobilní zařízení = Bottom Sheet) */
@media (max-width: 768px) {
    .map-sidebar {
        top: auto;
        bottom: -100%;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 70vh;
        border-radius: 24px 24px 0 0;
        border-bottom: none;
        border-left: none;
        border-right: none;
        transition: bottom 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    .map-sidebar.open {
        right: 0;
        bottom: 0;
    }
    
    .map-overlay-top {
        top: 10px;
        width: 95%;
    }
    
    .map-filter-btn {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
}

/* Notifikace o novém výjezdu v mapě */
.map-toast-container {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 9999;
    width: 320px;
    max-width: calc(100vw - 40px);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.map-toast-item {
    pointer-events: auto;
    animation: slideInLeft 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    background: rgba(20, 20, 25, 0.95);
    border: 1px solid rgba(255, 77, 77, 0.5);
    border-left: 4px solid #ff4d4d;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    overflow: hidden;
}
.map-toast-item .card {
    margin: 0;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 15px;
}
.map-toast-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #a0a0a5;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}
.map-toast-close:hover {
    color: #fff;
}
@keyframes slideInLeft {
    from { transform: translateX(-120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-120%); opacity: 0; }
}
