/*======================================
   AESearch Styles
   Версия: 1.0 (Оптимизированная)
======================================*/

/* ---- Блок результатов (базовые стили) ---- */
.aesearch-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 999999 !important; /* Максимальный приоритет */
    background: #ffffff;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-height: 500px;
    overflow-y: auto;
    padding: 8px 0;
    margin-top: 4px;
    border: 1px solid #e8ecf1;
    width: 100%;
    min-width: 300px;
}

/* ---- Показываем блок с результатами ---- */
.aesearch-results:not(.hidden) {
    display: block;
    animation: aesearchFadeIn 0.2s ease;
}

/* ---- Скрываем блок (класс из скрипта) ---- */
.aesearch-results.hidden {
    display: none !important;
}

/* ======================================
   ИСПРАВЛЕНИЕ: Убираем overflow: hidden у всех секций и оберток
   ====================================== */
.hero-section,
.hero-section-wrap,
section,
#sec2,
.container,
.fl-wrap,
.main-search-input,
.main-search-input-wrap {
    overflow: visible !important;
}

/* ======================================
   ИСПРАВЛЕНИЕ: Поднимаем блоки выше всех слоев
   ====================================== */
.aesearch {
    position: relative;
    z-index: 9999 !important;
}

.main-search-input-wrap {
    position: relative;
    z-index: 99999 !important;
}

/* ---- Пузырьки на фоне не должны мешать ---- */
.bubble-bg {
    z-index: 0 !important;
    pointer-events: none !important;
}

/* ---- Стили для одного элемента результата ---- */
.aesearch-item {
    padding: 0;
    border-bottom: 1px solid #f0f2f5;
}
.aesearch-item:last-child {
    border-bottom: none;
}

.aesearch-item-link {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    transition: background 0.2s ease;
}
.aesearch-item-link:hover {
    background: #f5f7fa;
}

.aesearch-item-title {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: #2a5885;
    margin-bottom: 4px;
}
.aesearch-item-category {
    display: inline-block;
    font-size: 11px;
    color: #ffffff;
    background: #4DB7FE;
    padding: 2px 12px;
    border-radius: 12px;
    margin-bottom: 4px;
}
.aesearch-item-description {
    display: block;
    font-size: 13px;
    color: #6b7a8f;
    line-height: 1.4;
    margin-top: 4px;
}

/* ---- Подсветка найденных слов (от evoSearch) ---- */
.evoSearch_highlight {
    color: #4DB7FE;
    font-weight: 700;
}

/* ---- Сообщение "ничего не найдено" ---- */
.aesearch-empty {
    padding: 20px;
    text-align: center;
    color: #6b7a8f;
    font-size: 14px;
}

/* ---- Анимация появления ---- */
@keyframes aesearchFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ======================================
   АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ====================================== */
@media (max-width: 768px) {
    .aesearch-results {
        min-width: auto;
        max-height: 300px;
        border-radius: 0 0 6px 6px;
        margin-top: 2px;
        left: 10px;
        right: 10px;
        width: auto;
    }
    .aesearch-item-link {
        padding: 10px 15px;
    }
    .aesearch-item-title {
        font-size: 14px;
    }
    .aesearch-item-description {
        font-size: 12px;
    }
    .aesearch-item-category {
        font-size: 10px;
        padding: 1px 10px;
    }
}

@media (max-width: 480px) {
    .aesearch-results {
        max-height: 250px;
        padding: 4px 0;
    }
    .aesearch-item-link {
        padding: 8px 12px;
    }
    .aesearch-item-title {
        font-size: 13px;
    }
}

/* ---- Стили для скролла (WebKit) ---- */
.aesearch-results::-webkit-scrollbar {
    width: 6px;
}
.aesearch-results::-webkit-scrollbar-track {
    background: #f0f2f5;
    border-radius: 3px;
}
.aesearch-results::-webkit-scrollbar-thumb {
    background: #c5cdd8;
    border-radius: 3px;
}
.aesearch-results::-webkit-scrollbar-thumb:hover {
    background: #a8b3c2;
}

/* ---- Стили для скролла (Firefox) ---- */
.aesearch-results {
    scrollbar-width: thin;
    scrollbar-color: #c5cdd8 #f0f2f5;
}