/* styles/map.css - ФИНАЛЬНАЯ ВЕРСИЯ */
/* styles/map.css - ИСПРАВЛЕННАЯ ВЕРСИЯ */
/* Все стили для карты, балунов, фильтров и элементов управления */

/* ===== ОСНОВНЫЕ СТИЛИ ===== */
.map-section {
    padding: 80px 0;
    position: relative;
}

.map-section .section-title {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.map-wrapper {
    position: relative;
    width: 100%;
    height: 800px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
}

/* ===== САЙДБАР ФИЛЬТРОВ ===== */
.sidebar {
    width: 320px;
    background: #fff;
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #eee;
    flex-shrink: 0;
    transition: width 0.3s ease-in-out;
    overflow: hidden;
}

.sidebar-header {
    height: 60px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 18px;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
    color: #333;
}

.toggle-btn {
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: transform 0.3s ease, background-color 0.2s;
}

.toggle-btn:hover {
    background-color: #f0f0f0;
}

.sidebar.collapsed {
    width: 50px;
}

.sidebar.collapsed .header-title {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
}

.sidebar.collapsed .toggle-btn {
    transform: rotate(180deg);
}

.sidebar.collapsed .filter-list {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0s 0.2s;
}

.filter-list {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s;
    flex-grow: 1;
    overflow-y: auto;
}

/* Элементы фильтров */
.filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-transform: uppercase;
    text-align: left;
    min-height: 50px;
    box-sizing: border-box;
    position: relative;
}

.filter-item:hover {
    background-color: #f9f9f9;
}

.filter-item.active {
    background-color: #6DB0E1;
    color: #fff;
}

.filter-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #333;
    border-radius: 3px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
    margin-left: auto;
}

.filter-item.active .filter-checkbox {
    border-color: #fff;
    background-color: #fff;
}

.filter-checkbox::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid #6DB0E1;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.filter-item.active .filter-checkbox::after {
    opacity: 1;
}

.filter-text {
    flex-grow: 1;
    text-align: left;
    line-height: 1.3;
    padding-right: 10px;
}

/* Выпадающий список городов */
.city-filter-dropdown {
    max-height: 0;
    overflow: hidden;
    background-color: #f7f7f7;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.city-filter-dropdown.open {
    max-height: 300px;
    padding: 15px;
    border-top: 1px solid #eee;
    overflow-y: auto;
}

.city-search {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
}

.city-checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
    color: #444;
    transition: color 0.2s ease;
}

.city-checkbox-item:hover {
    color: #000;
}

.city-checkbox-item input[type="checkbox"] {
    margin: 0;
    margin-right: 8px;
}

.select-all-cities-btn {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background-color: #6DB0E1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
}

.select-all-cities-btn:hover {
    background-color: #5b9dc7;
}

/* ===== КОНТЕЙНЕР КАРТЫ ===== */
.map-container {
    flex-grow: 1;
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ===== БАЛУНЫ И КЛАСТЕРЫ ===== */
.ymaps-2-1-79-balloon {
    box-shadow: none !important;
    border-radius: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
}

.ymaps-2-1-79-balloon__layout, 
.ymaps-2-1-79-balloon__content {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.ymaps-2-1-79-balloon__tail,
.ymaps-2-1-79-balloon__tail::after {
    display: none !important;
    visibility: hidden !important;
}

.custom-balloon {
    width: 300px !important;
    padding: 0 !important;
    background-color: #fff !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    position: relative !important;
    font-family: 'Roboto', sans-serif !important;
}

.balloon-title-top {
    font-weight: 700;
    font-size: 16px;
    color: #333;
    padding: 15px 40px 10px 15px;
    text-align: left;
    line-height: 1.3;
}

.custom-close {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    font-weight: 300;
    z-index: 10;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: none;
    border: none;
    border-radius: 4px;
}

.custom-close:hover {
    color: #333;
    background: rgba(0,0,0,0.05);
}

.horizontal-line {
    border-top: 1px solid #eee !important;
    margin: 0 15px !important;
}

.balloon-content {
    padding: 15px;
}

.balloon-type {
    font-size: 14px;
    color: #007bff;
    font-weight: 600;
    margin-bottom: 5px;
    text-transform: none;
}

.balloon-city {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 10px;
}

.balloon-description {
    font-size: 14px;
    color: #555;
    line-height: 1.4;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.balloon-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    text-align: right;
}

.details-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
    font-family: 'Roboto', sans-serif;
}

.details-button:hover {
    background-color: #0056b3;
}

/* Кластеры */
.ymaps-2-1-79-cluster {
    background: #4a90e2 !important;
    border: 3px solid white !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2) !important;
}

.ymaps-2-1-79-cluster__content {
    background: transparent !important;
    color: white !important;
    font-family: 'Roboto', sans-serif !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    padding: 0 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

/* Элементы кластера в карусели */
.cluster-item {
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-family: 'Roboto', sans-serif;
    max-width: 280px;
}

.cluster-item-header {
    margin-bottom: 8px;
}

.cluster-item-header strong {
    font-size: 16px;
    color: #333;
    line-height: 1.3;
}

.cluster-item-type {
    font-size: 14px;
    color: #007bff;
    font-weight: 600;
    margin-bottom: 5px;
}

.cluster-item-city {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 8px;
}

.cluster-item-description {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    margin-bottom: 12px;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cluster-details-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.2s;
    width: 100%;
    font-family: 'Roboto', sans-serif;
}

.cluster-details-btn:hover {
    background-color: #0056b3;
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    padding-bottom: 50px;
}

.modal-content {
    background-color: #ffffff;
    margin: 0 auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    position: relative;
    animation: fadeIn 0.3s;
    z-index: 10001;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid #e0e0e0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
}

.modal-close:hover,
.modal-close:focus {
    color: #333;
    text-decoration: none;
}

#modal-org-name {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-top: 0;
    margin-bottom: 10px;
    padding-right: 40px;
    line-height: 1.3;
}

#modal-title {
    font-size: 16px;
    color: #007bff;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.modal-link-container {
    margin-bottom: 20px;
}

.social-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s;
    font-size: 14px;
}

.social-link:hover {
    background-color: #218838;
    text-decoration: none;
    color: white;
}

.modal-description-full {
    margin-top: 20px;
}

#modal-description {
    font-size: 16px;
    color: #555;
    line-height: 1.6;
    white-space: pre-wrap;
}

#modal-description p {
    margin-bottom: 15px;
}

#modal-description strong {
    color: #333;
    font-weight: 600;
}

/* Стили для поиска на карте */
.ymaps-2-1-79-search__suggest {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ymaps-2-1-79-search__suggest-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.ymaps-2-1-79-search__suggest-item:hover {
    background-color: #f5f5f5;
}

.ymaps-2-1-79-search__input {
    border: 2px solid #4a90e2 !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    font-size: 16px !important;
}

.search-suggest-item {
    font-family: 'Roboto', sans-serif;
    color: #333;
}

.search-suggest-item strong {
    color: #4a90e2;
}

/* Стили для полноэкранного режима */
.map-fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    transition: all 0.3s ease;
}

.map-fullscreen-btn:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.map-fullscreen-btn svg {
    width: 18px;
    height: 18px;
}

.map-section.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: white;
    padding: 0 !important;
    margin: 0 !important;
}

.map-section.fullscreen .container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.map-section.fullscreen .map-wrapper {
    height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.map-section.fullscreen .map-container {
    width: 100% !important;
    height: 100% !important;
}

.map-section.fullscreen .sidebar {
    z-index: 10000;
    height: 100vh !important;
}

/* Модальное окно поверх полноэкранной карты */
.modal-overlay {
    z-index: 99999 !important;
}

/* Предотвращение прокрутки при полноэкранном режиме */
body.map-fullscreen-active {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* АДАПТИВНОСТЬ */
@media (max-width: 768px) {
    .map-wrapper {
        height: 600px;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .sidebar.collapsed {
        width: 50px;
    }
    
    .map-fullscreen-btn {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .map-fullscreen-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .map-section.fullscreen .sidebar {
        width: 280px !important;
    }
    
    .map-section.fullscreen .sidebar.collapsed {
        width: 50px !important;
    }
    
    .modal-content {
        padding: 20px 15px;
        width: 95%;
        margin: 0 auto;
    }
    
    .modal-overlay {
        padding: 20px 10px;
        align-items: center;
    }
    
    #modal-org-name {
        font-size: 20px;
    }
    
    .custom-balloon {
        width: 280px !important;
    }
}

@media (max-width: 480px) {
    .map-wrapper {
        height: 500px;
    }
    
    .sidebar {
        width: 100%;
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    
    .sidebar.collapsed {
        width: 100%;
        height: 50px;
        max-height: 50px;
    }
    
    .sidebar.collapsed .toggle-btn {
        transform: rotate(90deg);
    }
    
    .filter-list {
        max-height: 200px;
    }
    
    .map-fullscreen-btn {
        padding: 6px 10px;
        font-size: 11px;
        gap: 4px;
    }
    
    .map-fullscreen-btn span {
        display: none;
    }
    
    .map-fullscreen-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .map-section.fullscreen .map-wrapper {
        flex-direction: column !important;
    }
    
    .map-section.fullscreen .sidebar {
        width: 100% !important;
        max-height: 40vh !important;
        border-right: none !important;
        border-bottom: 1px solid #eee !important;
    }
    
    .map-section.fullscreen .sidebar.collapsed {
        height: 50px !important;
        max-height: 50px !important;
    }
    
    .custom-balloon {
        width: 260px !important;
    }
    
    .modal-content {
        width: 95%;
        padding: 15px;
    }
}