*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

#map {
    height: 100vh;
    width: 100%;
}

.leaflet-control-attribution {
    display: none !important;
}

/* Плашка с названием региона */
.region-info {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(3px);
    overflow: auto;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 12px;
    max-width: 1200px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    z-index: 10;
}

.modal-close:hover {
    color: #000;
}

.modal-content h2 {
    margin: 0 0 20px 0;
    color: #2e7d32;
    font-size: 24px;
}

/* Двухколоночная раскладка */
.modal-body {
    display: flex;
    gap: 20px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Левая колонка - СНиП */
.modal-left {
    flex: 1 1 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Правая колонка - Графики */
.modal-right {
    flex: 1 1 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-left: 10px;
    border-left: 1px solid #e0e0e0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Стили секций */
.climate-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(245, 245, 245, 0.3);
    border-radius: 8px;
    border: 1px solid #cccccc;
}

.climate-section:first-child {
    margin-top: 0;
}

.climate-section h3 {
    margin: 0 0 15px 0;
    color: #1b5e20;
    font-size: 16px;
}

/* ===== ЗАГОЛОВОК СНиП И ЗОНЫ (в одну строку) ===== */
.snip-header {
    margin: 0 0 15px 0;
    padding: 12px 15px;
    background: rgba(46, 125, 50, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(46, 125, 50, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.snip-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #1b5e20;
    margin: 0;
}

.snip-header-zone {
    font-size: 16px;
    color: #555;
    margin: 0;
}

.snip-header-zone span {
    font-weight: bold;
    color: #2e7d32;
    font-size: 16px;
}

/* ===== ЗАГОЛОВОК ПРАВОЙ КОЛОНКИ ===== */
.right-column-header {
    margin: 0 0 15px 0;
    padding: 12px 15px;
    background: rgba(46, 125, 50, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(46, 125, 50, 0.3);
}

.right-column-header h3 {
    margin: 0;
    color: #1b5e20;
    font-size: 16px;
    font-weight: 600;
}

/* Данные СНиП */
.climate-data {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-item {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #bbbbbb;
}

.data-label {
    color: #666;
    font-size: 12px;
    margin-bottom: 4px;
}

.data-value {
    color: #2e7d32;
    font-weight: bold;
    font-size: 15px;
}

/* ===== ТАБЛИЦЫ СНиП ===== */

/* Основная таблица СНиП */
.snip-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 10px;
}

.snip-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

.snip-table td:first-child {
    color: #555;
    line-height: 1.4;
    font-size: 13px;
}

.snip-table td:nth-child(2) {
    color: #888;
    font-size: 12px;
    width: 50px;
    text-align: center;
}

.snip-table td:last-child {
    color: #2e7d32;
    font-weight: bold;
    text-align: right;
    width: 70px;
    font-size: 14px;
}

.snip-table tr:hover {
    background: rgba(129, 199, 132, 0.1);
}

/* Маленькая табличка с числом дней */
.snip-table-small {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 10px;
    border: 1px solid #c8e6c9;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    overflow: hidden;
}

.snip-table-small thead {
    background: rgba(129, 199, 132, 0.2);
}

.snip-table-small th {
    padding: 10px 6px;
    text-align: center;
    font-weight: 600;
    color: #1b5e20;
    border-bottom: 2px solid #81C784;
    font-size: 13px;
}

.snip-table-small td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.snip-table-small tbody td:first-child {
    text-align: left;
    color: #555;
    font-weight: 500;
}

.snip-table-small tbody td:last-child {
    color: #2e7d32;
    font-weight: bold;
    font-size: 14px;
}

/* ===== ГРАФИКИ В ЛЕВОЙ КОЛОНКЕ ===== */
.chart-container-left {
    height: 260px;
    position: relative;
    margin-top: 10px;
}

/* ===== ГРАФИКИ В ПРАВОЙ КОЛОНКЕ ===== */
.chart-container-small {
    height: 260px;
    position: relative;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Кастомный скроллбар */
.modal-left::-webkit-scrollbar,
.modal-right::-webkit-scrollbar {
    width: 6px;
}

.modal-left::-webkit-scrollbar-track,
.modal-right::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.modal-left::-webkit-scrollbar-thumb,
.modal-right::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.modal-left::-webkit-scrollbar-thumb:hover,
.modal-right::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Адаптивность для планшетов и маленьких экранов */
@media (max-width: 768px) {
    .modal-content {
        max-width: 100%;
        width: 98%;
        padding: 15px;
    }

    .modal-body {
        gap: 10px;
    }

    .modal-left {
        padding-right: 5px;
    }

    .modal-right {
        padding-left: 5px;
    }

    .climate-section h3 {
        font-size: 13px;
    }

    .chart-container-small {
        height: 180px;
    }

    .chart-container-left {
        height: 180px;
    }

    .data-value {
        font-size: 13px;
    }

    /* Адаптивность таблиц */
    .snip-table {
        font-size: 12px;
    }

    .snip-table td {
        padding: 6px 8px;
    }

    .snip-table td:first-child {
        font-size: 12px;
    }

    .snip-table td:nth-child(2) {
        font-size: 11px;
    }

    .snip-table td:last-child {
        font-size: 13px;
    }

    .snip-table-small {
        font-size: 12px;
    }

    .snip-table-small th,
    .snip-table-small td {
        padding: 6px;
        font-size: 12px;
    }

    /* Адаптивность заголовков */
    .snip-header {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .snip-header-title {
        font-size: 14px;
    }

    .snip-header-zone {
        font-size: 12px;
    }

    .snip-header-zone span {
        font-size: 13px;
    }

    .right-column-header {
        padding: 10px 12px;
    }

    .right-column-header h3 {
        font-size: 14px;
    }
}

/* Для очень маленьких экранов (телефоны) */
@media (max-width: 480px) {
    .modal-body {
        flex-direction: column;
    }

    .modal-left,
    .modal-right {
        flex: none;
        width: 100%;
        min-width: 0;
        border-left: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 0;
        margin-bottom: 15px;
    }

    .modal-right {
        border-bottom: none;
        margin-bottom: 0;
    }

    .chart-container-small {
        height: 200px;
    }

    .chart-container-left {
        height: 200px;
    }

    /* Ещё меньше на телефонах */
    .snip-table {
        font-size: 11px;
    }

    .snip-table td {
        padding: 5px 6px;
    }

    .snip-table td:first-child {
        font-size: 11px;
    }

    .snip-table td:nth-child(2) {
        font-size: 10px;
    }

    .snip-table td:last-child {
        font-size: 12px;
    }

    .snip-table-small {
        font-size: 11px;
    }

    .snip-table-small th,
    .snip-table-small td {
        padding: 5px;
        font-size: 11px;
    }

    .snip-header {
        padding: 10px;
    }

    .snip-header-title {
        font-size: 13px;
    }

    .snip-header-zone {
        font-size: 11px;
    }

    .snip-header-zone span {
        font-size: 12px;
    }

    .right-column-header {
        padding: 10px;
    }

    .right-column-header h3 {
        font-size: 13px;
    }
}
/* ===== ЗАГОЛОВОК МОДАЛКИ С ИКОНКАМИ ===== */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-header h2 {
    margin: 0;
    color: #2e7d32;
    font-size: 24px;
    flex: 1;
}

.header-icons {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-right: 45px;
}

/* Круглая иконка */
.icon-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    /*overflow: hidden;*/
    cursor: pointer;
    border: 2px solid rgba(46, 125, 50, 0.3);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-wrapper:hover {
    border-color: #2e7d32;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Кастомный tooltip при наведении */
.icon-wrapper::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 10px);
    right: -30px;
    left: auto;
    transform: none;
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Стрелочка tooltip */
.icon-wrapper::before {
    content: '';
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(30, 30, 30, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1100;
}

.icon-wrapper:hover::after,
.icon-wrapper:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Адаптивность заголовка */
@media (max-width: 768px) {
    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .icon-wrapper {
        width: 38px;
        height: 38px;
    }
    
    .icon-wrapper::after {
        font-size: 12px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .header-icons {
        gap: 8px;
    }
    
    .icon-wrapper {
        width: 34px;
        height: 34px;
    }
}