.irm-map-container {
    position: relative;
    margin: 0 auto;
    padding-top: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    max-width: 100%;
    width: var(--irm-map-width, 100%);
    height: var(--irm-height, 1000px);
}

.irm-map {
    width: 100%;
    height: 100%;
}

.irm-map .irm-region {
    transition: fill 0.2s ease;
    cursor: pointer;
}

.irm-map .irm-region path,
.irm-map .irm-region {
    pointer-events: all;
}

/* Tooltip при наведении на регион */
.irm-tooltip {
    position: fixed;
    z-index: 999998;
    background: #3770BF;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(55, 112, 191, 0.4);
    opacity: 0;
    transition: opacity 0.15s ease;
    max-width: 300px;
}

.irm-tooltip.irm-tooltip-visible {
    opacity: 1;
}

.irm-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #3770BF;
}

/* Hover эффекты — только для устройств с мышью */
@media (hover: hover) {
    .irm-map .irm-region:hover {
        opacity: 0.9;
    }
}

/* Touch-устройства — активное состояние вместо hover */
@media (hover: none) {
    .irm-map .irm-region:active {
        opacity: 0.85;
        transition: opacity 0.15s ease;
    }
}

.irm-map .irm-region.irm-active {
    stroke: #3770BF;
    stroke-width: 2;
}

/* Стили для вкладок федеральных округов */
.irm-federal-districts-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 20px 10px 10px;
    margin-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.irm-tab-btn {
    padding: 10px 18px;
    border: 2px solid transparent;
    border-radius: 25px;
    background: #f5f5f5;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.irm-tab-btn:hover {
    background: #e8e8e8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.irm-tab-btn.active {
    background: var(--tab-color, #3498db);
    color: #fff;
    border-color: var(--tab-color, #3498db);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.irm-tab-btn[data-district="all"].active {
    background: #2c3e50;
    border-color: #2c3e50;
}

/* Анимация регионов при фильтрации */
.irm-map .irm-region.irm-hidden {
    opacity: 0.15;
    pointer-events: none;
}

.irm-map .irm-region.irm-highlight {
    opacity: 1;
    filter: brightness(1.1);
}

/* Modal Styles */
.irm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.irm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.irm-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: irm-modal-slide-in 0.3s ease-out;
}

@keyframes irm-modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.irm-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 10;
}

.irm-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.irm-modal-body {
    padding: 30px;
}

.irm-modal-title {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: #333;
    line-height: 1.3;
}

.irm-modal-text {
    color: #555;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 15px;
}

.irm-modal-text p {
    margin: 0 0 15px 0;
}

.irm-modal-text p:last-child {
    margin-bottom: 0;
}

.irm-modal-footer {
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.irm-modal-button {
    display: inline-block;
    background: #3498db;
    color: #fff;
    text-decoration: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
}

.irm-modal-button:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.irm-modal-button:active {
    transform: translateY(0);
}

/* ======== Responsive ======== */

/* Планшеты (768–1024px) */
@media (max-width: 1024px) {
    .irm-map-container {
        height: var(--irm-height-mobile, var(--irm-height, 600px));
    }

    .irm-federal-districts-tabs {
        gap: 8px;
        padding: 15px 8px 8px;
    }

    .irm-tab-btn {
        padding: 9px 16px;
        font-size: 13px;
    }
}

/* Мобильные (≤768px) — адаптивная высота */
@media (max-width: 768px) {
    .irm-modal-content {
        width: 95%;
        margin: 20px auto;
    }

    .irm-modal-body {
        padding: 20px;
    }

    .irm-modal-title {
        font-size: 20px;
    }

    /* Адаптивная высота карты для мобильных */
    .irm-map-container.irm-mobile-adaptive {
        height: auto !important;
        aspect-ratio: 2 / 1.3;
        min-height: var(--irm-height-mobile, 250px);
    }

    .irm-map-container.irm-mobile-adaptive {
        touch-action: manipulation;
    }

    .irm-map-container.irm-mobile-adaptive .irm-map .irm-region {
        transition: fill 0.15s ease;
    }

    /* Адаптивность вкладок */
    .irm-federal-districts-tabs {
        gap: 8px;
        padding: 15px 8px 8px;
    }

    .irm-tab-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* Tooltip на мобильных — чуть меньше */
    .irm-tooltip {
        font-size: 13px;
        padding: 6px 12px;
    }
}

/* Маленькие мобильные (≤480px) */
@media (max-width: 480px) {
    .irm-map-container.irm-mobile-adaptive {
        aspect-ratio: 2 / 1.4;
        min-height: 200px;
    }

    .irm-federal-districts-tabs {
        gap: 6px;
        padding: 10px 5px 5px;
    }

    .irm-tab-btn {
        padding: 7px 12px;
        font-size: 12px;
    }

    .irm-modal-content {
        width: 98%;
        border-radius: 8px;
    }

    .irm-modal-body {
        padding: 15px;
    }

    .irm-modal-title {
        font-size: 18px;
    }

    .irm-modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 24px;
    }

    .irm-tooltip {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* Телефон в горизонтальной ориентации — использовать планшетную высоту */
@media (max-width: 1024px) and (max-height: 500px) {
    .irm-map-container.irm-mobile-adaptive {
        height: auto !important;
        aspect-ratio: 2.5 / 1;
        min-height: 200px;
    }
}
