/* CSS стилі для карти клінік BBL - ФИНАЛЬНАЯ СИНХРОНИЗИРОВАННАЯ ВЕРСИЯ С КИРПИЧНОЙ КЛАДКОЙ */

/* Сброс стилей для контейнера карты */
.post__entry .container {
    max-width: 100% !important;
    margin: 20px 0 !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1) !important;
    overflow: hidden !important;
    padding: 0 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    line-height: 1.6 !important;
}

/* Заголовок карты */
.post__entry .container .map-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 30px !important;
    text-align: center !important;
    margin: 0 !important;
    border: none !important;
}

.post__entry .container .map-header h2 {
    margin: 0 !important;
    font-size: 2rem !important;
    font-weight: 300 !important;
    color: white !important;
    border: none !important;
    padding: 0 !important;
}

.post__entry .container .map-header p {
    margin: 10px 0 0 0 !important;
    opacity: 0.9 !important;
    font-size: 1.1rem !important;
    color: white !important;
    padding: 0 !important;
}

/* Фільтри - КОМПАКТНАЯ ВЕРСИЯ */
.post__entry .container .filters {
    padding: 15px 20px !important;
    background: #f8f9fa !important;
    border-bottom: 1px solid #e9ecef !important;
    margin: 0 !important;
}

.post__entry .container .filters h3 {
    margin: 0 0 10px 0 !important;
    color: #495057 !important;
    font-size: 1.1rem !important;
    border: none !important;
    padding: 0 !important;
}

.post__entry .container .filter-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
    align-items: flex-start !important;
    margin: 0 !important;
}

.post__entry .container .filter-group {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 8px !important;
    flex: 1 !important;
    margin: 0 !important;
}

/* Кнопки управления - КОМПАКТНЫЕ */
.filter-controls {
    margin-bottom: 10px !important;
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

.filter-control-btn {
    background: #667eea !important;
    color: white !important;
    border: none !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 11px !important;
    transition: background 0.3s ease !important;
    white-space: nowrap !important;
    min-width: auto !important;
}

.filter-control-btn:hover {
    background: #5a67d8 !important;
}

.filter-control-btn.secondary {
    background: #6c757d !important;
}

.filter-control-btn.secondary:hover {
    background: #5a6268 !important;
}

/* Счетчик - КОМПАКТНЫЙ */
.cities-counter {
    font-size: 11px !important;
    color: #6c757d !important;
    font-weight: 500 !important;
    margin-left: auto !important;
    white-space: nowrap !important;
}

/* Элементы фильтров - КОМПАКТНЫЕ */
.post__entry .container .filter-item {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    padding: 6px 8px !important;
    border-radius: 6px !important;
    background: white !important;
    border: 1px solid #e9ecef !important;
    transition: all 0.3s ease !important;
    font-size: 13px !important;
    margin: 0 !important;
    text-decoration: none !important;
    min-width: auto !important;
    justify-content: flex-start !important;
}

.post__entry .container .filter-item:hover {
    border-color: #667eea !important;
    background: #f8f9ff !important;
    transform: translateY(-1px) !important;
    text-decoration: none !important;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.15) !important;
}

/* Чекбоксы - КОМПАКТНЫЕ */
.post__entry .container .filter-item input[type="checkbox"] {
    margin: 0 !important;
    width: 14px !important;
    height: 14px !important;
    accent-color: #667eea !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
}

/* Текст в фильтрах */
.post__entry .container .filter-item span {
    color: #495057 !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    user-select: none !important;
    font-size: 13px !important;
}

/* Состояние активного фильтра */
.post__entry .container .filter-item input[type="checkbox"]:checked + span {
    color: #667eea !important;
    font-weight: 600 !important;
}

.post__entry .container .filter-item:has(input[type="checkbox"]:checked) {
    background: #f0f4ff !important;
    border-color: #667eea !important;
}

/* Селект процедур - КОМПАКТНЫЙ */
.post__entry .container .procedure-select {
    padding: 6px 10px !important;
    border: 1px solid #e9ecef !important;
    border-radius: 6px !important;
    background: white !important;
    font-size: 13px !important;
    min-width: 160px !important;
    cursor: pointer !important;
    transition: border-color 0.3s ease !important;
    margin: 0 !important;
}

.post__entry .container .procedure-select:focus {
    outline: none !important;
    border-color: #667eea !important;
}

/* Контейнер карты - УВЕЛИЧЕННАЯ ВЫСОТА */
.post__entry .container .map-container {
    padding: 0 !important;
    position: relative !important;
    margin: 0 !important;
    height: 650px !important;
    width: 100% !important;
    z-index: 1 !important;
}

.post__entry .container #map {
    height: 650px !important;
    width: 100% !important;
    z-index: 1 !important;
    position: relative !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: #f0f0f0 !important;
}

/* Статистика */
.post__entry .container .stats {
    padding: 20px 30px !important;
    background: #f8f9fa !important;
    display: flex !important;
    justify-content: space-around !important;
    text-align: center !important;
    margin: 0 !important;
    border: none !important;
}

.post__entry .container .stat-item {
    flex: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.post__entry .container .stat-number {
    font-size: 2rem !important;
    font-weight: bold !important;
    color: #667eea !important;
    margin-bottom: 5px !important;
    border: none !important;
    padding: 0 !important;
}

.post__entry .container .stat-label {
    color: #6c757d !important;
    font-size: 0.9rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Leaflet элементы - КРИТИЧЕСКИ ВАЖНО */
.leaflet-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    height: 650px !important;
    width: 100% !important;
}

.leaflet-popup-content {
    font-family: inherit !important;
    margin: 0 !important;
    padding: 8px !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.leaflet-popup-tip {
    background: white !important;
}

/* Контролы карты */
.leaflet-control-zoom a {
    background-color: white !important;
    border: 2px solid #667eea !important;
    color: #667eea !important;
    text-decoration: none !important;
}

.leaflet-control-zoom a:hover {
    background-color: #667eea !important;
    color: white !important;
    text-decoration: none !important;
}

/* Попапы */
.popup-content {
    min-width: 250px !important;
    font-family: inherit !important;
}

.popup-title {
    font-size: 1.2rem !important;
    font-weight: bold !important;
    color: #495057 !important;
    margin-bottom: 10px !important;
    border-bottom: 2px solid #667eea !important;
    padding-bottom: 5px !important;
}

.popup-info {
    margin: 8px 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 14px !important;
}

.popup-procedures {
    margin-top: 10px !important;
}

.popup-procedures h5 {
    margin: 0 0 5px 0 !important;
    color: #495057 !important;
    font-size: 14px !important;
}

.procedure-tag {
    display: inline-block !important;
    background: #e3f2fd !important;
    color: #1976d2 !important;
    padding: 3px 8px !important;
    border-radius: 12px !important;
    font-size: 0.8rem !important;
    margin: 2px !important;
    font-weight: 500 !important;
    border: none !important;
}

.route-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    margin-top: 10px !important;
    transition: transform 0.2s ease !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
}

.route-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
    text-decoration: none !important;
}

/* Кастомна іконка - БЕЗ ДЕРГАЮЩИХ ЭФФЕКТОВ */
.custom-div-icon {
    background: white !important;
    border: 3px solid #667eea !important;
    border-radius: 50% !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    cursor: pointer !important;
}

.custom-div-icon:hover {
    border-color: #764ba2 !important;
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.4) !important;
}

/* Кнопки зума карты - фиксы для мобильной версии */
.leaflet-control-zoom {
    position: absolute !important;
}

/* На больших экранах - стандартное расположение */
@media (min-width: 769px) {
    .leaflet-control-zoom {
        top: 10px !important;
        left: 10px !important;
    }
}

/* Адаптивные названия городов */
.city-full {
    display: inline !important;
}

.city-short {
    display: none !important;
}

/* Адаптив для планшетов */
@media (max-width: 1024px) {
    .post__entry .container .filter-group {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
        gap: 6px !important;
    }
    
    .post__entry .container .filters {
        padding: 12px 15px !important;
    }
}

/* Адаптив для мобильных устройств - КИРПИЧНАЯ КЛАДКА */
@media (max-width: 768px) {
    .post__entry .container .map-header {
        padding: 20px !important;
    }
    
    .post__entry .container .map-header h2 {
        font-size: 1.5rem !important;
    }
    
    .post__entry .container .filters {
        padding: 10px 12px !important;
    }
    
    .post__entry .container .filter-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    /* КИРПИЧНАЯ КЛАДКА - адаптивная ширина по содержимому */
    .post__entry .container .filter-group {
        display: flex !important;  /* Изменили с grid на flex */
        flex-wrap: wrap !important;
        gap: 6px !important;
        justify-content: flex-start !important;
        align-items: flex-start !important;
        width: 100% !important;
    }
    
    .post__entry .container .filter-item {
        padding: 6px 10px !important;  /* Увеличили горизонтальный padding */
        font-size: 12px !important;
        justify-content: center !important;
        flex: 0 0 auto !important;  /* Не растягиваются, размер по содержимому */
        min-width: auto !important;  /* Убрали минимальную ширину */
        width: auto !important;     /* Ширина по содержимому */
        max-width: none !important; /* Убрали ограничение максимальной ширины */
        white-space: nowrap !important; /* Запрещаем перенос текста */
        border-radius: 12px !important;  /* Более округлые углы для "кирпичиков" */
    }
    
    .post__entry .container .filter-item:hover {
        transform: translateY(-1px) scale(1.02) !important;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25) !important;
    }
    
    /* Компактные кнопки управления */
    .filter-controls {
        flex-wrap: wrap !important;
        gap: 6px !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .filter-control-btn {
        padding: 5px 8px !important;
        font-size: 10px !important;
        flex: 0 0 auto !important;
    }
    
    .cities-counter {
        font-size: 10px !important;
        margin-left: auto !important;
        order: 3 !important; /* Перемещаем в конец */
        width: 100% !important;
        text-align: center !important;
        margin-top: 4px !important;
    }
    
    .post__entry .container .procedure-select {
        width: 100% !important;
        min-width: auto !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }
    
    .post__entry .container .stats {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 12px !important;
    }
    
    .post__entry .container #map {
        height: 500px !important;
    }
    
    .post__entry .container .map-container {
        height: 500px !important;
    }
    
    .leaflet-container {
        height: 500px !important;
    }
    
    /* Эффект "кирпичной кладки" - слегка разные отступы для визуального разнообразия */
    .post__entry .container .filter-item:nth-child(3n+1) {
        margin-right: 2px !important;
    }
    
    .post__entry .container .filter-item:nth-child(3n+2) {
        margin-left: 1px !important;
        margin-right: 1px !important;
    }
    
    .post__entry .container .filter-item:nth-child(3n+3) {
        margin-left: 2px !important;
    }
    
    /* Визуальные улучшения для кирпичной кладки */
    .post__entry .container .filter-group {
        line-height: 1.2 !important;
    }
    
    /* Перемещение кнопок зума на мобильных */
    .leaflet-control-zoom {
        top: auto !important;
        left: auto !important;
        right: 10px !important;
        bottom: 10px !important;
        z-index: 1000 !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 8px !important;
        padding: 2px !important;
        backdrop-filter: blur(10px) !important;
    }
    
    /* Стили кнопок зума на мобильном */
    .leaflet-control-zoom a {
        width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
        font-size: 16px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border: 2px solid #667eea !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
        backdrop-filter: blur(5px) !important;
    }
    
    .leaflet-control-zoom a:hover {
        background: #667eea !important;
        color: white !important;
    }
}

/* Очень маленькие экраны - еще более компактно */
@media (max-width: 480px) {
    .post__entry .container .map-header h2 {
        font-size: 1.3rem !important;
    }
    
    .post__entry .container .map-header p {
        font-size: 1rem !important;
    }
    
    .post__entry .container .filters {
        padding: 8px 10px !important;
    }
    
    .post__entry .container .filters h3 {
        font-size: 1rem !important;
        margin-bottom: 6px !important;
    }
    
    /* Еще более компактная кирпичная кладка */
    .post__entry .container .filter-group {
        gap: 4px !important;
    }
    
    .post__entry .container .filter-item {
        padding: 4px 8px !important;
        font-size: 11px !important;
    }
    
    /* Компактные чекбоксы */
    .post__entry .container .filter-item input[type="checkbox"] {
        width: 12px !important;
        height: 12px !important;
    }
    
    .post__entry .container .filter-item span {
        font-size: 11px !important;
    }
    
    .filter-controls {
        margin-bottom: 6px !important;
    }
    
    .filter-control-btn {
        padding: 4px 6px !important;
        font-size: 9px !important;
    }
    
    .cities-counter {
        font-size: 9px !important;
        margin-top: 3px !important;
    }
    
    .post__entry .container #map {
        height: 450px !important;
    }
    
    .post__entry .container .map-container {
        height: 450px !important;
    }
    
    .leaflet-container {
        height: 450px !important;
    }
    
    /* Очень маленькие экраны - еще более компактные кнопки зума */
    .leaflet-control-zoom {
        right: 5px !important;
        bottom: 5px !important;
    }
    
    .leaflet-control-zoom a {
        width: 28px !important;
        height: 28px !important;
        line-height: 28px !important;
        font-size: 14px !important;
    }
    
    /* На мобильных показываем короткие названия для длинных городов */
    .filter-item .city-full {
        display: none !important;
    }
    
    .filter-item .city-short {
        display: inline !important;
    }
}

/* Ультра-маленькие экраны (старые телефоны) */
@media (max-width: 360px) {
    .post__entry .container .filter-item {
        padding: 3px 6px !important;
        font-size: 10px !important;
    }
    
    .post__entry .container .filter-item input[type="checkbox"] {
        width: 10px !important;
        height: 10px !important;
    }
    
    .post__entry .container .filter-item span {
        font-size: 10px !important;
    }
    
    .post__entry .container .filters h3 {
        font-size: 0.9rem !important;
    }
    
    .filter-control-btn {
        padding: 3px 5px !important;
        font-size: 8px !important;
    }
    
    .cities-counter {
        font-size: 8px !important;
    }
}

/* Дополнительные фиксы для конфликтов с темой */
.post__entry .container * {
    box-sizing: border-box !important;
}

.post__entry .container .leaflet-control-container {
    pointer-events: auto !important;
}

.post__entry .container .leaflet-control {
    pointer-events: auto !important;
}

/* Фикс для кнопок навигации карты */
.leaflet-control-zoom-in, .leaflet-control-zoom-out {
    text-decoration: none !important;
    display: block !important;
    width: 26px !important;
    height: 26px !important;
    line-height: 26px !important;
    text-align: center !important;
}

/* Убираем стили ссылок для элементов карты */
.post__entry .container a.route-btn,
.post__entry .container .filter-item,
.post__entry .container .popup-info a {
    text-decoration: none !important;
}

.post__entry .container a.route-btn:hover,
.post__entry .container .filter-item:hover,
.post__entry .container .popup-info a:hover {
    text-decoration: none !important;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post__entry .container {
    animation: fadeIn 0.6s ease-out !important;
}