/* ============================================================
   Live Search — assets/live-search.css
   Встраивается в хедер темы GeneratePress / gp-child
   ============================================================ */

/* ── Кнопка-иконка в хедере ─────────────────────────────── */
.live-search__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    color: inherit;
    transition: background 0.2s, color 0.2s;
}
.live-search__toggle:hover,
.live-search__toggle:focus-visible {
    background: rgba(0,0,0,0.08);
    outline: none;
}

/* ── Оверлей ────────────────────────────────────────────── */
.live-search__overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9998;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: ls-fade-in 0.2s ease;
}
.live-search__overlay.is-visible {
    display: block;
}

/* ── Панель ─────────────────────────────────────────────── */
.live-search__panel {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    width: min(680px, 96vw);
    max-height: 80vh;
    background: #fff;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1),
                opacity  0.2s ease;
}
.live-search__panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* ── Строка ввода ───────────────────────────────────────── */
.live-search__input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    flex-shrink: 0;
}
.live-search__input-icon {
    flex-shrink: 0;
    color: #999;
}
.live-search__input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    color: #111;
    background: transparent;
    line-height: 1.4;
    /* сброс системных стилей для type=search */
    -webkit-appearance: none;
    appearance: none;
}
.live-search__input::-webkit-search-cancel-button { display: none; }
.live-search__input::placeholder { color: #aaa; }

.live-search__clear,
.live-search__close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    color: #888;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.live-search__clear:hover,
.live-search__close:hover {
    background: #f0f0f0;
    color: #333;
}

/* ── Результаты ─────────────────────────────────────────── */
.live-search__results {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 0 4px;
}
.live-search__results:empty { display: none; }

/* ── Статус (загрузка / пусто) ──────────────────────────── */
.live-search__status {
    padding: 24px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}
.live-search__status--empty::before {
    content: '🔍 ';
}

/* ── Группа результатов ─────────────────────────────────── */
.live-search__group {
    margin-bottom: 4px;
}
.live-search__group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
}
.live-search__group-icon { font-size: 13px; }

/* ── Элемент результата ─────────────────────────────────── */
.live-search__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    text-decoration: none;
    color: #111;
    transition: background 0.12s;
    cursor: pointer;
}
.live-search__item:hover,
.live-search__item.is-active {
    background: #f5f5f5;
    text-decoration: none;
    color: #111;
}

/* ── Миниатюра ──────────────────────────────────────────── */
.live-search__thumb {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    background: #f0f0f0;
}
.live-search__thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 6px;
    background: #f5f5f5;
}

/* ── Текст элемента ─────────────────────────────────────── */
.live-search__item-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.live-search__item-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.live-search__item-meta {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Подсветка запроса ──────────────────────────────────── */
.live-search__mark {
    background: #fff3cd;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* ── Футер «Показать все» ───────────────────────────────── */
.live-search__footer {
    border-top: 1px solid #eee;
    padding: 10px 16px;
    flex-shrink: 0;
}
.live-search__all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent, #0071ce);
    text-decoration: none;
    transition: opacity 0.15s;
}
.live-search__all:hover { opacity: 0.75; text-decoration: none; }
.live-search__all svg { flex-shrink: 0; }

/* ── Анимации ───────────────────────────────────────────── */
@keyframes ls-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Позиционирование в .ab-actions ────────────────────────
   Кнопка-иконка вписывается рядом с другими иконками хедера */
.ab-actions .live-search,
.ab-container .live-search {
    display: flex;
    align-items: center;
}

/* ── Скроллбар в результатах ────────────────────────────── */
.live-search__results::-webkit-scrollbar { width: 4px; }
.live-search__results::-webkit-scrollbar-track { background: transparent; }
.live-search__results::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* ── Адаптив ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .live-search__panel {
        width: 100vw;
        border-radius: 0 0 12px 12px;
        max-height: 90vh;
    }
    .live-search__thumb {
        width: 34px;
        height: 34px;
    }
}
