/* Живой поиск phmlife.ru — выезжающая строка справа, от кнопки «Поиск» */
#gkLiveSearch {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    z-index: 60;
}
#gkLiveSearch .gkls-box {
    display: flex;
    align-items: center;
    overflow: hidden;
    width: 0;
    opacity: 0;
    transition: width .3s cubic-bezier(.4, 0, .2, 1), opacity .22s ease;
    background: #fff;
    border-radius: 22px;
    height: 42px;
}
#gkLiveSearch.open .gkls-box {
    width: 320px;
    opacity: 1;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .22);
}
/* иконка лупы внутри строки слева */
#gkLiveSearch .gkls-box::before {
    content: "\f002";
    font-family: FontAwesome;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 4px 0 16px;
    color: #d0021b;
    font-size: 15px;
    line-height: 1;
}
#gkLiveSearch input.gkls-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
    border: 0;
    outline: 0;
    margin: 0;
    padding: 0 8px 0 8px;
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: normal;
    color: #222;
    background: transparent;
}
#gkLiveSearch input.gkls-input::placeholder { color: #aaa; }
#gkLiveSearch .gkls-clear {
    flex: 0 0 auto;
    border: 0;
    background: none;
    color: #bbb;
    font-size: 16px;
    cursor: pointer;
    padding: 0 16px 0 6px;
    line-height: 1;
}
#gkLiveSearch .gkls-clear:hover { color: #d0021b; }

/* выпадашка результатов */
#gkLiveSearch .gkls-drop {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-width: 92vw;
    max-height: 70vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
    display: none;
}
#gkLiveSearch.has-results .gkls-drop { display: block; }

#gkLiveSearch .gkls-item {
    display: block;
    padding: 11px 14px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #222;
}
#gkLiveSearch .gkls-item:last-child { border-bottom: 0; }
#gkLiveSearch .gkls-item:hover,
#gkLiveSearch .gkls-item.active { background: #f4f6f8; }
#gkLiveSearch .gkls-title {
    display: block;
    font: 600 14px/1.3 Arial, sans-serif;
    color: #111;
    margin-bottom: 3px;
}
#gkLiveSearch .gkls-snippet {
    display: block;
    font: 13px/1.4 Arial, sans-serif;
    color: #777;
}
#gkLiveSearch .gkls-snippet b,
#gkLiveSearch .gkls-title b { color: #d0021b; font-weight: 700; }

#gkLiveSearch .gkls-foot {
    display: block;
    padding: 10px 14px;
    text-align: center;
    font: 600 13px/1 Arial, sans-serif;
    color: #d0021b;
    text-decoration: none;
    background: #fafafa;
}
#gkLiveSearch .gkls-foot:hover { background: #f0f0f0; }
#gkLiveSearch .gkls-empty {
    padding: 14px;
    color: #999;
    font: 13px Arial, sans-serif;
    text-align: center;
}

/* мобилка: строка и выпадашка на всю ширину экрана (не выезжают от кнопки) */
@media (max-width: 767px) {
    #gkLiveSearch.open {
        position: fixed;
        top: 8px;
        left: 8px;
        right: 8px;
        transform: none;
        margin: 0;
        z-index: 100001;
    }
    #gkLiveSearch.open .gkls-box {
        width: 100%;
        height: 46px;
    }
    #gkLiveSearch.open .gkls-drop {
        position: fixed;
        top: 62px;
        left: 8px;
        right: 8px;
        bottom: 8px;                    /* до низа экрана — весь низ скроллится */
        width: auto;
        max-width: none;
        max-height: none;
        overflow-y: auto;
        overscroll-behavior: contain;   /* скролл выдачи не проваливается на сайт */
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
    /* блокируем прокрутку сайта, пока открыт поиск */
    body.phm-search-open {
        overflow: hidden;
    }
}

/* ============ Страница поиска com_finder ============ */
.phm-finder { max-width: 820px; }
.phm-finder__heading { margin: 0 0 18px; }

.phm-finder__form { margin-bottom: 26px; }
.phm-finder__field {
    display: flex;
    align-items: stretch;
    gap: 10px;
}
/* прячем возможную подпись поля (класс bootstrap visually-hidden в нашем шаблоне не определён) */
.phm-finder__field label,
.phm-finder .visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.phm-finder__input {
    flex: 1 1 auto;
    height: 48px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0 15px;
    font: 16px/48px Arial, sans-serif;
    outline: 0;
}
.phm-finder__input:focus { border-color: #d0021b; }
.phm-finder__btn {
    flex: 0 0 auto;
    height: 48px;
    display: inline-flex;
    align-items: center;
    border: 0;
    border-radius: 4px;
    background: #d0021b;
    color: #fff;
    font: 600 15px/1 Arial, sans-serif;
    padding: 0 24px;
    cursor: pointer;
}
.phm-finder__btn:hover { background: #a80016; }
.phm-finder__btn .fa { margin-right: 6px; }

/* счётчик результатов ядра */
.phm-finder .result__count,
.phm-finder .counter { color: #666; margin-bottom: 18px; }

/* список результатов — карточки */
.phm-finder__results ol,
.phm-finder__results ul.search-results {
    list-style: none;
    margin: 0;
    padding: 0;
}
.phm-result {
    display: flex;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid #eee;
}
.phm-result:last-child { border-bottom: 0; }
.phm-result__thumb {
    flex: 0 0 120px;
    display: block;
}
.phm-result__thumb img {
    width: 120px;
    height: 82px;
    object-fit: cover;
    border-radius: 3px;
    display: block;
}
.phm-result__body { flex: 1 1 auto; min-width: 0; }
.phm-result__title {
    margin: 0 0 6px;
    font: 700 18px/1.3 Arial, sans-serif;
}
.phm-result__title a { color: #1a1a1a; text-decoration: none; }
.phm-result__title a:hover { color: #d0021b; }
.phm-result__desc {
    margin: 0 0 8px;
    color: #555;
    font: 14px/1.5 Arial, sans-serif;
}
/* подсветка найденного слова ядром finder (была жёлтая) — в цвет сайта */
.phm-result__desc .highlight,
.phm-finder .highlight,
.phm-result__title .highlight {
    background: none;
    color: #d0021b;
    font-weight: 700;
    padding: 0;
}
.phm-result__meta {
    font: 13px/1 Arial, sans-serif;
    color: #999;
}
.phm-result__meta time { margin-right: 12px; }
.phm-result__cat {
    display: inline-block;
    background: #f0f0f0;
    color: #666;
    border-radius: 3px;
    padding: 3px 9px;
}

@media (max-width: 580px) {
    .phm-result__thumb, .phm-result__thumb img { flex-basis: 90px; width: 90px; height: 62px; }
    .phm-result__title { font-size: 16px; }
}

/* подсветка найденного слова (mark.js) — из жёлтого маркера в цвет сайта */
.phm-finder mark,
.phm-finder mark[data-markjs] {
    background: none;
    color: #d0021b;
    font-weight: 700;
    padding: 0;
}

/* когда открыт наш живой поиск — глушим старый оверлей/попап шаблона */
body.phm-search-open #gkPopupOverlay,
body.phm-search-open #gkPopupFollow,
body.phm-search-open #gkPopupSearch {
    display: none !important;
    pointer-events: none !important;
}

/* пояснение запроса на странице результатов («найдено N элементов») */
#search-query-explained {
    padding: 5px 0;
}
