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

#map {
    width: 100%;
    height: 100vh;
    background: #dce6ee;
    position: relative;
    min-width: 0;
}

/*===========================================================
        стили панели (переключатель слоёв + легенда активного слоя)
//=========================================================== */

#legend-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    font-family: Arial, sans-serif;
    width: 240px;         
    box-sizing: border-box;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* --- переключатель слоёв (вкладки, одиночный выбор) --- */
#layer-switcher {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.layer-item {
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #16323d;
    width: 100%;
    box-sizing: border-box;
    white-space: normal;    /* длинная подпись переносится на вторую строку, а не раздвигает панель */
    word-break: break-word;
    line-height: 1.3;
}

.layer-item:hover {
    background: #f0f0f0;
}

.layer-item.active {
    background: #256472;
    color: #ffffff;
    font-weight: bold;
}

/* --- разделитель между переключателем слоёв и легендой --- */
#layer-legend {
    border-top: 1px solid #e0e0e0;
    padding-top: 8px;
    margin-top: 4px;
}

/* --- легенда активного слоя (клик = фильтр по цвету, мультивыбор) --- */
.legend-item {
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.legend-item:hover {
    background: #f0f0f0;
}

/* Активный (выбранный кликом) пункт фильтра. Несколько пунктов могут быть
   активны одновременно*/
.legend-item.active {
    background: #dbe9ee;
    outline: 1px solid #256472;
    font-weight: bold;
}

.legend-item span:first-child {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    display: inline-block;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-item .legend-text {
    width: auto;
    height: auto;
    font-size: 12px;
    border-radius: 0;
    display: inline;
}

#clear-filter {
    margin-top: 10px;
    width: 100%;
    cursor: pointer;
    box-sizing: border-box;
}

/*===========================================================
        точечные маркеры данных
//=========================================================== */

/* Маркер группы 3 в слое "prioritet" — наполовину одним цветом, наполовину другим */
.split-marker-icon {
    background: transparent;
    border: none;
}

/* Квадрат со значением внутри — заменяет точку на близком зуме */
.value-square-icon {
    background: transparent;
    border: none;
}

.value-square {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    border: 1px solid #ffffff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    font-family: Arial, sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    padding: 0 3px;
    box-sizing: border-box;
}

/*===========================================================
        маркеры городов (Москва, СПб, Севастополь) 
//=========================================================== */

.city-marker-icon {
    background: transparent;
    border: none;
}

.city-marker {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #16323d;
    white-space: nowrap;
    transform: translate(-4px, -8px); /* точка встаёт ровно в координату центра региона */
    transition: transform 0.15s ease, filter 0.15s ease;
}

.city-marker .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #256472;
    border: 2px solid #ffffff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}

.city-marker .label {
    text-shadow:
        0 0 3px #ffffff,
        0 0 3px #ffffff,
        0 0 3px #ffffff,
        0 0 3px #ffffff;
}

.city-marker.highlight {
    transform: translate(-4px, -8px) scale(1.3);
    filter: drop-shadow(0 0 5px rgba(37, 100, 114, 0.9));
}

/*===========================================================
        адаптив под встраивание в iframe 940x600
//=========================================================== */
@media (max-width: 960px), (max-height: 620px) {
    #legend-panel {
        top: 10px;
        right: 10px;
        padding: 10px;
        font-size: 12px;
        width: 190px;
    }

    .layer-item {
        font-size: 12px;
        padding: 5px 6px;
    }

    .legend-item span:first-child {
        width: 14px;
        height: 14px;
        margin-right: 6px;
    }

    #clear-filter {
        font-size: 11px;
        padding: 4px 0;
    }
}

/* Стиль для кастомного попапа, который следует за курсором */
.custom-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: Arial;
    font-size: 12px;
    display: none;
}

/*===========================================================
        стили панели - конец
//=========================================================== */
