/* ===== Site Search Module — дизайн «РУБДЕНТ» ===== */

/* --- Dropdown (navbar) --- */
.search-dropdown-wrap {
    position: relative;
}
.search-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 0.75rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 1000;
}
.search-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.search-dropdown-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.search-dropdown-input {
    flex: 1;
    border: 1px solid #E5E7EB;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    background: #fff;
    color: #444;
}
.search-dropdown-input:focus {
    outline: none;
    border-color: var(--green-600);
    box-shadow: 0 0 0 0.2rem rgba(var(--green-600-rgb),.12);
}
.search-dropdown-btn {
    background: var(--amber);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.search-dropdown-btn:hover {
    background: var(--green-900);
}
.search-dropdown-close {
    background: none;
    border: none;
    color: #9f9f9f;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.search-dropdown-close:hover {
    color: #444;
}
@media (max-width: 991px) {
    .search-dropdown-menu {
        width: 300px;
        right: -40px;
    }
}
@media (max-width: 640px) {
    /* На узких экранах — панель под шапкой на всю ширину, чтобы не уезжать за край */
    .search-dropdown-menu {
        position: fixed;
        top: var(--header-h);
        left: 12px;
        right: 12px;
        width: auto;
    }
}

/* --- Страница поиска --- */
.search-page-box {
    padding: 0 0.5rem;
}
.search-page-box.is-autocomplete-open {
    padding-bottom: 360px;
}
.search-page-title {
    font-family: var(--serif);
    font-size: 1.75rem;
    font-weight: 700;
    color: #00030a;
    margin-bottom: 0.75rem;
}
.search-page-subtitle {
    color: #9f9f9f;
    font-size: 1rem;
    margin-bottom: 1.75rem;
}
.site-search-form {
    max-width: 620px;
    margin: 0 auto;
}
.site-search-form .search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.site-search-form input[type="search"] {
    flex: 1;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    border: 1px solid #E5E7EB;
    font-size: 1rem;
    background: #fff;
    color: #444;
}
.site-search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--green-600);
    box-shadow: 0 0 0 0.2rem rgba(var(--green-600-rgb),.12);
}
.site-search-form button {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    background: var(--amber);
    color: #fff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.site-search-form button:hover {
    background: var(--green-900);
}
.search-status {
    margin-top: 1rem;
    color: #9f9f9f;
    font-size: 0.9rem;
}

/* --- Список результатов --- */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.search-result-card {
    display: block;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    transition: all 0.25s ease;
    text-decoration: none;
    color: #444;
}
.search-result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: var(--green-600);
}
.search-result-page {
    font-size: 0.85rem;
    color: #9f9f9f;
    margin-bottom: 0.25rem;
}
.search-result-title {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--green-900);
    margin-bottom: 0.5rem;
}
.search-result-snippet {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.5;
}
.search-result-snippet mark {
    background: #FFE69C;
    color: #664D03;
    padding: 0.05em 0.15em;
    border-radius: 3px;
    font-weight: 600;
}
.search-no-results {
    text-align: center;
    color: #9f9f9f;
    padding: 2rem 0;
}

/* --- Подсветка на целевых страницах --- */
.search-hit {
    background: #FFE69C;
    color: #664D03;
    padding: 0.05em 0.15em;
    border-radius: 3px;
    font-weight: 600;
    animation: searchHitFade 30s ease forwards;
}
@keyframes searchHitFade {
    0% { background: #FFE69C; }
    95% { background: #FFE69C; }
    100% { background: transparent; color: inherit; }
}

/* --- Autocomplete --- */
.search-autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    z-index: 1000;
    max-height: 320px;
    overflow-y: auto;
    display: none;
}
.search-autocomplete-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    display: block;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #444;
}
.search-autocomplete-item:hover {
    background: #F9FAFB;
}
.search-autocomplete-item strong {
    color: var(--green-900);
}
.search-dropdown-menu .search-autocomplete-list {
    top: calc(100% + 4px);
    border-radius: 0 0 12px 12px;
}
