/* ===== Site Search Module — Академия Дент ===== */

/* --- Dropdown в шапке --- */
.search-dropdown-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 100%;
}
.search-dropdown-toggle {
    cursor: pointer;
}
.rd-nav-icon-item .search-dropdown-toggle {
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transition: color 0.2s ease, opacity 0.2s ease;
}
.rd-nav-icon-item .search-dropdown-toggle:hover,
.rd-nav-icon-item .search-dropdown-toggle:focus {
    opacity: 0.75;
    outline: none;
}
.search-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 28px);
    background: #ffffff;
    border: 1px solid #e3e8e4;
    border-radius: 12px;
    box-shadow: 0 18px 40px -8px rgba(0, 0, 0, 0.22);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
    z-index: 2050;
}
.search-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.search-dropdown-form {
    display: flex;
    align-items: center;
    gap: 8px;
}
.search-dropdown-input {
    flex: 1;
    min-width: 0;
    border: 1.5px solid #dfe5e0;
    border-radius: 40px;
    padding: 10px 16px;
    font-size: 14.5px;
    font-family: inherit;
    background: #f7faf8;
    color: #222;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-dropdown-input:focus {
    border-color: var(--bs-color, #009024);
    box-shadow: 0 0 0 3px rgba(0, 144, 36, 0.14);
}
.search-dropdown-btn {
    background: var(--bs-color, #009024);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.search-dropdown-btn:hover {
    opacity: 0.9;
    transform: scale(1.04);
}
.search-dropdown-close {
    background: none;
    border: none;
    color: #8a938c;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s ease;
}
.search-dropdown-close:hover {
    color: #222;
}

/* --- Страница поиска --- */
.search-page-section {
    padding-top: 42px;
    padding-bottom: 70px;
}
.search-page-inner {
    max-width: 920px;
    margin: 0 auto;
}
.search-page-title {
    font-size: 30px;
    line-height: 1.25;
    font-weight: 700;
    text-align: center;
    color: #1f2a22;
    margin: 0 0 10px;
}
.search-page-subtitle {
    text-align: center;
    color: #6c766e;
    font-size: 15px;
    line-height: 1.65;
    margin: 0 auto 28px;
    max-width: 640px;
}
.search-page-box {
    padding: 0 0.5rem;
}
.site-search-form {
    max-width: 660px;
    margin: 0 auto 10px;
}
.site-search-form .search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 13px 22px;
    border-radius: 40px;
    border: 1.5px solid #dfe5e0;
    font-size: 15px;
    font-family: inherit;
    background: #ffffff;
    color: #222;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.site-search-form input[type="search"]:focus {
    border-color: var(--bs-color, #009024);
    box-shadow: 0 0 0 3px rgba(0, 144, 36, 0.14);
}
.site-search-form button {
    padding: 13px 26px;
    border-radius: 40px;
    background: var(--bs-color, #009024);
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-family: inherit;
    font-size: 14.5px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 144, 36, 0.18);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.site-search-form button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}
.search-status {
    margin-top: 16px;
    color: #6c766e;
    font-size: 14.5px;
    line-height: 1.5;
}
.search-status strong {
    color: var(--bs-color, #009024);
}
.search-no-results {
    text-align: center;
    color: #6c766e;
    padding: 2rem 0 0;
    font-size: 15px;
    line-height: 1.6;
}
.search-no-results a {
    color: var(--bs-color, #009024);
    text-decoration: underline;
}

/* --- Результаты --- */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 860px;
    margin: 34px auto 0;
}
.search-result-card {
    display: block;
    background: #ffffff;
    border: 1px solid #e3e8e4;
    border-radius: 12px;
    padding: 20px 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-decoration: none !important;
    color: #222;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}
.search-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.1);
    border-color: var(--bs-color, #009024);
}
.search-result-page {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bs-color, #009024);
    margin-bottom: 6px;
}
.search-result-title {
    font-weight: 700;
    font-size: 17px;
    line-height: 1.4;
    color: #1f2a22;
    margin-bottom: 8px;
}
.search-result-snippet {
    font-size: 14.5px;
    color: #5c665e;
    line-height: 1.65;
    word-break: break-word;
}
.search-result-snippet mark {
    background: #ffe69c;
    color: #664d03;
    padding: 0 1px;
    border-radius: 2px;
    font-weight: 700;
}

/* --- Подсветка на целевой странице --- */
mark.search-hit,
.search-hit {
    background: #ffe69c !important;
    color: #664d03 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    outline: none !important;
    border-radius: 0 !important;
    font-weight: 700;
    display: inline !important;
    line-height: inherit;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    animation: searchHitFade 30s ease forwards;
}
@keyframes searchHitFade {
    0% { background: #ffe69c; }
    90% { background: #ffe69c; }
    100% { background: transparent; color: inherit; }
}

/* --- Autocomplete --- */
.search-autocomplete-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e3e8e4;
    border-radius: 10px;
    box-shadow: 0 18px 40px -8px rgba(0, 0, 0, 0.2);
    list-style: none;
    margin: 0;
    padding: 6px 0;
    z-index: 2060;
    max-height: 320px;
    overflow-y: auto;
    display: none;
}
.search-autocomplete-item {
    padding: 8px 18px;
    cursor: pointer;
    font-size: 14.5px;
    display: block;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #222;
    transition: background 0.15s ease, color 0.15s ease;
}
.search-autocomplete-item:hover {
    background: #f1f7f3;
    color: var(--bs-color, #009024);
}
.search-autocomplete-item strong {
    color: var(--bs-color, #009024);
}
.search-dropdown-menu .search-autocomplete-list {
    top: calc(100% + 4px);
    border-radius: 0 0 10px 10px;
    z-index: 2061;
}

/* --- Режим для слабовидящих --- */
body.bvi-body .search-dropdown-menu,
body.bvi-body .search-result-card,
body.bvi-body .search-autocomplete-list,
body.bvi-body .site-search-form input[type="search"] {
    background: #111111 !important;
    border-color: #ffff00 !important;
    color: #ffffff !important;
}
body.bvi-body .search-dropdown-btn,
body.bvi-body .site-search-form button {
    background: #ffff00 !important;
    color: #000000 !important;
}
body.bvi-body .search-result-title,
body.bvi-body .search-result-page,
body.bvi-body .search-autocomplete-item strong,
body.bvi-body .search-status strong {
    color: #ffff00 !important;
}

/* --- Адаптивность --- */
@media (max-width: 991.98px) {
    .search-dropdown-menu {
        top: calc(100% + 8px);
        left: 0;
        right: auto;
        width: 240px;
        max-width: calc(100vw - 40px);
    }
}
@media (max-width: 767.98px) {
    .search-page-title {
        font-size: 25px;
    }
    .search-result-card {
        padding: 17px 18px;
    }
}
@media (max-width: 575.98px) {
    .site-search-form .search-input-wrap {
        flex-wrap: wrap;
    }
    .site-search-form input[type="search"] {
        flex-basis: 100%;
    }
    .site-search-form button {
        width: 100%;
    }
}
