/* Принудительное переопределение стилей поиска MediaWiki Vector */

/* Поле ввода - БЕЗ рамки! */
input#searchInput,
#searchInput,
.mw-searchInput {
    padding: 10px 14px !important;
    font-size: 15px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    width: 100% !important;
    box-shadow: none !important;
    outline: none !important;
}

input#searchInput:focus,
#searchInput:focus,
.mw-searchInput:focus {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

/* Контейнер */
#simpleSearch {
    border: 2px solid #a2a9b1 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    display: flex !important;
    align-items: stretch !important;
    overflow: visible !important;
    transition: all 0.2s ease !important;
    height: auto !important;
    min-height: 42px !important;
    position: relative !important;
    z-index: 1 !important;
}

#simpleSearch:focus-within {
    border-color: #3366cc !important;
    box-shadow: 0 0 0 3px rgba(51, 102, 204, 0.2) !important;
}

/* Кнопка поиска - ПОЛНОСТЬЮ СКРЫВАЕМ */
#searchButton,
#mw-searchButton,
.searchButton {
    display: none !important;
}

/* Кнопка полностью скрыта - правила hover и img больше не нужны */

/* КРИТИЧЕСКИ ВАЖНО: Подсказки должны скроллиться! */
.suggestions.better-search-suggestions,
.better-search-suggestions {
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    /* НЕ перезаписываем border - JS установит красную рамку */
    border: inherit !important;
    background: inherit !important;
    box-shadow: inherit !important;
}

/* ПРИНУДИТЕЛЬНО СКРЫВАЕМ СТАРЫЕ ПОДСКАЗКИ MEDIAWIKI */
/* НО НЕ ТРОГАЕМ НАШИ! */
.suggestions:not(.better-search-suggestions),
div.suggestions:not(.better-search-suggestions),
.searchresults .suggestions:not(.better-search-suggestions),
.mw-searchSuggest-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Старые suggestions-result ТОЛЬКО если они НЕ внутри нашего контейнера */
body > .suggestions-result:not(.better-search-suggestions .suggestions-result),
body > .suggestions-results:not(.better-search-suggestions .suggestions-results) {
    display: none !important;
}

/* НАШИ элементы ДОЛЖНЫ быть видны! */
.better-search-suggestions .suggestions-result,
.better-search-suggestions .suggestions-results {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Контейнер результатов внутри */
.better-search-suggestions .suggestions-results {
    max-height: none !important;
    overflow: visible !important;
}

/* МОБИЛЬНЫЕ УСТРОЙСТВА - отступы и центрирование */
@media (max-width: 768px) {
    /* Главный контейнер - вертикальное центрирование */
    body #content,
    #content {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        min-height: 60vh !important;
    }
    
    /* Родительский контейнер поиска */
    #p-search,
    #searchform {
        margin: 24px 0 0 0 !important;
        padding: 0 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    
    /* Само поле - ограничиваем ширину */
    #simpleSearch {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Подсказки привязываем к input */
    .better-search-suggestions {
        left: 16px !important;
        width: calc(100vw - 32px) !important;
        max-width: calc(100vw - 32px) !important;
        box-sizing: border-box !important;
    }
}
