html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Open Sans', sans-serif;
}

body { 
    display: flex; 
}

#map { 
    flex: 1; 
}

.maplibregl-popup-content {
    border-radius: 12px;
    padding: 12px 14px;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
}

.popup-content h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
}

.popup-content hr {
    margin: 6px 0;
    border: none;
    border-top: 1px solid #ddd;
}

.russian-scale-control {
    background: rgba(255, 255, 255, 0);
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 4px;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0);
}

.russian-scale-line {
    height: 1.5px;
    background: black;
    margin-bottom: 4px;
}

.russian-scale-labels {
    display: flex;
    justify-content: space-between;
}

.panel {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}

.panel-title {
    font-weight: 600;
    cursor: pointer;
}

.panel-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.panel.active .panel-content {
    max-height: 300px;
}

.indicator {
    padding: 6px 4px;
    cursor: pointer;
}

.indicator:hover {
    background: #f0f0f0;
}

.indicator.active {
    font-weight: 600;

}

#mode-switch {
    margin-top: 24px;
    margin-bottom: 16px;
}

/* Основной контейнер */
.mode-container {
    position: relative;
    display: flex;
    width: 100%;
    height: 40px;
    background-color: #f1f1f1;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
}

/* Подвижный индикатор */
.mode-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc((100% - 8px) / 3);
    height: 32px;
    background-color: #8471A9;
    border-radius: 9px;
    transition: transform 0.25s ease;
}

.mode-container.clusters .mode-indicator {
    transform: translateX(100%);
}

.mode-container.districts .mode-indicator {
    transform: translateX(200%);
}

/* Когда выбран режим кластеров */
.mode-container.clusters .mode-indicator {
    transform: translateX(100%);
}

/* Текстовые кнопки */
.mode-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    z-index: 1;
    color: #555;
    transition: color 0.25s ease;
}

/* Активный текст */
.mode-option.active {
    color: white;
}

#logo-box {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.logo-circle {
    width: 36px;
    height: 36px;
    background: #8471A9;
    border-radius: 50%;
}

#sidebar {
    position: absolute;
    top: 70px;    /* под logo-box */
    bottom: 140px; /* над mode-box */
    left: 0;
    width: 280px;

    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(8px);
    padding: 20px;

    box-shadow: 6px 0 25px rgba(0,0,0,0.15);
    border-radius: 0 18px 18px 0;

    overflow-y: auto;

    transition: transform 0.35s ease;
    z-index: 5;
}

/* Изначально скрыта */
#sidebar.collapsed {
    transform: translateX(-100%);
}

/* ===== КНОПКА ===== */

#sidebar-toggle {
    position: absolute;

    top: 50vh;               /* центр экрана */
    transform: translateY(-50%);

    left: 310px;

    width: 36px;
    height: 56px;

    background: #8471A9;
    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: white;
    font-size: 18px;

    cursor: pointer;
    transition: left 0.35s ease;
    z-index: 4;
}

/* Когда панель скрыта */
#sidebar.collapsed + #sidebar-toggle {
    left: -10px; /* половина кнопки торчит */
}

/* Поворот стрелки */
#sidebar.collapsed + #sidebar-toggle span {
    transform: rotate(180deg);
    display: inline-block;
}

#mode-box {
    position: absolute;
    bottom: 30px;
    left: 20px;

    width: 260px;

    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(6px);
    padding: 16px;

    border-radius: 18px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);

    z-index: 4;
}

#legend-box {
    position: absolute;

    bottom: 30px; 
    right: 20px;

    width: 260px;

    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(6px);
    padding: 16px;

    border-radius: 18px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);

    font-size: 13px;
    z-index: 4;
}
.mode-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

#legend-title {
    font-weight: 600;
    margin-bottom: 10px;
}

/* Цветовая шкала */
.legend-bar {
    display: flex;
    height: 18px;
    margin-bottom: 8px;
    overflow: hidden;
}

.legend-segment {
    flex: 1;
}

/* Скругляем только крайние */
.legend-segment:first-child {
    border-radius: 9px 0 0 9px;
}

.legend-segment:last-child {
    border-radius: 0 9px 9px 0;
}

/* Подписи */
.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

@media (max-height: 800px) { 
    #sidebar {
        top: 60px;
    }

    #logo-box {
        top: 15px; /* можно оставить */
    }
}

.maplibregl-ctrl-bottom-right {
    margin-bottom: -10px;
}

.maplibregl-ctrl-bottom-right .russian-scale-control {
    margin-bottom: 100px;
}

#sidebar {
    scrollbar-width: thin;
}





















