/**
 * Кастомные стили для автозаполнения полей фильтра
 */

/* Стили для индикатора загрузки при фильтрации */
.clinics-grid .row.filtering {
    position: relative;
    min-height: 200px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.clinics-grid .row.filtering::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(122, 202, 205, 0.3);
    border-top: 4px solid #7acacd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Основной контейнер для поля ввода */
.input-wrapper,
.premium-input-wrapper {
    position: relative;
    width: 100%;
    z-index: 1;
}

/* Стилизация поля ввода */
.autocomplete-filter,
.premium-filter-input {
    height: 42px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    padding-left: 40px;
    width: 100%;
    font-size: 14px;
}

/* При наведении */
.autocomplete-filter:hover,
.premium-filter-input:hover {
    border-color: #7acacd;
}

/* При фокусе */
.autocomplete-filter:focus,
.premium-filter-input:focus {
    border-color: #7acacd;
    box-shadow: 0 0 0 2px rgba(122, 202, 205, 0.25);
    outline: none;
}

/* Иконки в фильтре */
.clinics-filter-group .filter-icon,
.premium-input-wrapper .premium-input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #7acacd;
    z-index: 10;
    pointer-events: none;
}

/* Выпадающий список с подсказками - ОТКЛЮЧЕН, ИСПОЛЬЗУЕМ СТИЛИ ИЗ clinics-premium-fix.css */
.suggestions-dropdown-old {
    display: none;
}

/* Активное состояние выпадающего списка */
.suggestions-dropdown.active {
    display: block;
}

/* Элементы списка подсказок */
.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* При наведении на элемент списка */
.suggestion-item:hover {
    background-color: #f0f8f8;
}

/* Активный элемент списка */
.suggestion-item.active {
    background-color: #7acacd;
    color: white;
}

/* Выделение совпадений в тексте */
.highlight {
    font-weight: bold;
    color: #7acacd;
}

/* Принудительные стили для преодоления конфликтов */
.suggestions-dropdown {
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.suggestion-item {
    background: transparent !important;
    color: #333 !important;
    border: none !important;
}

.suggestion-item:hover {
    background: #f0f8f8 !important;
    color: #333 !important;
}

.suggestion-item.active {
    background: #7acacd !important;
    color: white !important;
}

.highlight {
    color: #7acacd !important;
    font-weight: bold !important;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 767px) {
    .autocomplete-filter,
    .premium-filter-input {
        height: 38px;
        padding-left: 35px;
    }
    
    .clinics-filter-group .filter-icon,
    .premium-input-wrapper .premium-input-icon {
        left: 10px;
        font-size: 14px;
    }
    
    .clinics-filter-group,
    .premium-filter-block {
        margin-bottom: 10px;
    }
    
    /* Улучшение доступности для тач-устройств */
    .suggestion-item {
        padding: 12px 15px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Увеличиваем z-index еще больше на мобильных */
    .suggestions-dropdown {
        z-index: 9999999 !important;
    }
}

/* Стили для премиальных тегов фильтров */
.premium-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #7acacd 0%, #5ABABD 100%);
    color: white;
    font-size: 13px;
    font-weight: 500;
    border-radius: 20px;
    margin: 4px;
    box-shadow: 0 2px 4px rgba(122, 202, 205, 0.2);
    transition: all 0.3s ease;
}

.premium-filter-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(122, 202, 205, 0.3);
}

.filter-tag-text {
    font-size: 13px;
}

.filter-tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.filter-tag-remove:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Сообщение об отсутствии результатов */
.no-results-message {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.no-results-icon {
    margin-bottom: 20px;
}

/* Анимация загрузки для премиального дизайна */
.clinics-grid-premium.filtering {
    opacity: 0.6;
    position: relative;
    pointer-events: none;
}

.clinics-grid-premium.filtering::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(122, 202, 205, 0.3);
    border-top: 3px solid #7acacd;
    border-radius: 50%;
    animation: premium-spin 1s linear infinite;
    z-index: 1000;
}

@keyframes premium-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Дополнительная защита от z-index конфликтов */
.premium-filters-container,
.premium-filter-block,
.clinics-archive-layout {
    position: relative;
    z-index: auto;
}

/* Убеждаемся, что фильтры не создают новый stacking context */
.premium-filter-block {
    isolation: auto;
}

/* Форсируем высокий z-index для выпадающих списков */
.suggestions-dropdown.active {
    display: block;
    z-index: 999999 !important;
    position: absolute !important;
}

/* Убеждаемся, что родительские контейнеры не скрывают выпадающие списки */
.premium-filters-container,
.premium-sidebar-wrapper,
.clinics-archive-layout,
.container-fluid {
    overflow: visible !important;
}

/* Специфично для премиальных инпут-враперов */
.premium-input-wrapper {
    overflow: visible !important;
    z-index: 1 !important;
}

/* Убираем возможные ограничения высоты контейнеров */
.premium-filter-block {
    overflow: visible !important;
}

/* Улучшения для больших экранов */
@media (min-width: 1200px) {
    .suggestions-dropdown {
        max-height: 400px;
    }
    
    .suggestion-item {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* Стилизация для темного режима */
@media (prefers-color-scheme: dark) {
    .autocomplete-filter,
    .premium-filter-input {
        background-color: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .suggestions-dropdown {
        background-color: #2d2d2d;
        border-color: #444;
    }
    
    .suggestion-item {
        color: #e0e0e0;
    }
    
    .suggestion-item:hover {
        background-color: #444;
    }
    
    .highlight {
        color: #8fd4d7;
    }
    
    .no-results-message h3 {
        color: #e0e0e0 !important;
    }
    
    .no-results-message p {
        color: #a0a0a0 !important;
    }
}
