/* ============================================================
   МОДУЛЬ ПОИСКА — М.А.С. ДЕНТАЛ
   ============================================================ */

/* --- Выпадающее окно поиска в шапке сайта --- */
.search-dropdown-menu {
    position: absolute;
    top: calc(100% - 24px);
    right: 42px;
    width: 360px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 10px 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    z-index: 1050;
}

.search-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-dropdown-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.search-dropdown-input {
    flex: 1;
    background: #f3f5f8;
    border: 1px solid #e2e6eb;
    border-radius: 50px;
    padding: 8px 16px;
    font-size: 14px;
    color: #242222;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.search-dropdown-input::placeholder {
    color: #8c939b;
}

.search-dropdown-input:focus {
    border-color: #4f87d6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 135, 214, 0.2);
}

.search-dropdown-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #6fbce0 0%, #4f87d6 50%, #9443d4 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(79, 135, 214, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-dropdown-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(79, 135, 214, 0.5);
}

.search-dropdown-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #817e7e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s ease, background 0.2s ease;
}

.search-dropdown-close:hover {
    color: #242222;
    background: #eef1f5;
}

/* Адаптивность выпадающего окна на планшетах и мобильных */
@media (max-width: 991px) {
    .search-dropdown-menu {
        top: calc(100% - 16px);
        right: 24px;
        width: 320px;
    }
}

@media (max-width: 640px) {
    .search-dropdown-menu {
        top: calc(100% - 10px);
        left: 12px;
        right: 12px;
        width: auto;
        max-width: calc(100vw - 24px);
    }
}

/* --- Страница поиска (search.php) --- */
.search-section {
    padding: 60px 0 30px;
    background: #ffffff;
}

.search-results-section {
    padding: 0 0 80px;
    background: #ffffff;
}

.search-page-box {
    margin-bottom: 30px;
}

.search-page-box.is-autocomplete-open {
    padding-bottom: 280px;
}

.search-page-title {
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text, #242222);
}

.search-page-subtitle {
    font-size: 15px;
    color: var(--color-text-secondary, #817e7e);
}

.site-search-form {
    max-width: 720px;
    margin: 0 auto;
}

.site-search-form .search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    padding: 6px 8px 6px 18px;
    border: 2px solid var(--color-border, #E3E3E3);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.site-search-form .search-input-wrap:focus-within {
    border-color: #4f87d6;
    box-shadow: 0 6px 24px rgba(79, 135, 214, 0.2);
}

.site-search-form input[type="search"] {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: var(--color-text, #242222);
    background: transparent;
    padding: 10px 0;
}

.site-search-form input[type="search"]::placeholder {
    color: #9e9e9e;
}

.btn-search-submit {
    border: none;
    border-radius: 50px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(
        135deg,
        #6fbce0 0%,
        #4f87d6 35%,
        #3558b8 60%,
        #9443d4 85%,
        #6f39c5 100%
    );
    box-shadow: 0 4px 15px rgba(68, 144, 243, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-search-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(68, 144, 243, 0.45);
}

@media (max-width: 576px) {
    .site-search-form .search-input-wrap {
        padding: 4px 6px 4px 14px;
    }
    .site-search-form input[type="search"] {
        font-size: 14px;
    }
    .btn-search-submit {
        padding: 10px 18px;
        font-size: 14px;
    }
    .btn-search-submit span {
        display: none;
    }
}

/* Статусы и сообщения */
.search-feedback {
    text-align: center;
}

.search-status,
.search-no-results {
    font-size: 14px;
    padding: 12px 26px;
    border-radius: 50px;
    background: #f4f6f8;
    color: #444c54;
    border: 1px solid #e2e6eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.search-status strong,
.search-no-results strong {
    color: #242222;
    font-weight: 700;
}

.search-status--found {
    background: #f4f6f8;
    color: #444c54;
    border: 1px solid #e2e6eb;
}

.search-status--found i {
    color: #4f87d6;
}

.search-words-badge {
    color: #6c757d;
    font-weight: 500;
}

/* --- Список результатов поиска --- */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-result-card {
    display: block;
    background: #ffffff;
    border: 1px solid var(--color-border, #E3E3E3);
    border-radius: 16px;
    padding: 22px 28px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease;
}

.search-result-card:hover {
    transform: translateY(-3px);
    border-color: #4f87d6;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.search-result-page {
    font-size: 13px;
    font-weight: 600;
    color: #4f87d6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-arrow {
    font-size: 14px;
    color: #817e7e;
    transition: transform 0.2s ease, color 0.2s ease;
}

.search-result-card:hover .search-result-arrow {
    color: #4f87d6;
    transform: translateX(4px);
}

.search-result-title {
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text, #242222);
    margin-bottom: 8px;
    line-height: 1.4;
}

.search-result-snippet {
    font-size: 14px;
    color: var(--color-text-secondary, #817e7e);
    line-height: 1.6;
}

.search-result-title mark {
    background: #ffe58f;
    color: #1a1a1a;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 700;
    font-family: inherit;
    display: inline;
}

.search-result-snippet mark {
    background: #ffe58f;
    color: #1a1a1a;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
    display: inline;
}

/* --- Подсветка на целевых страницах (?hl=...&w[]=...) --- */
.search-hit {
    background: #ffe58f;
    color: #1a1a1a;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.45);
    display: inline;
    animation: searchHitFade 30s ease forwards;
}

@keyframes searchHitFade {
    0% {
        background: #ffe58f;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.45);
    }
    90% {
        background: #ffe58f;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.45);
    }
    100% {
        background: transparent;
        color: inherit;
        box-shadow: none;
    }
}

/* --- Autocomplete выпадающий список --- */
.search-autocomplete-list {
    position: absolute;
    left: 0;
    right: 0;
    list-style: none;
    margin: 0;
    padding: 6px 0;
    max-height: 320px;
    overflow-y: auto;
    display: none;
    z-index: 1100;
}

/* Автокомплит в выпадающем окне шапки */
.search-dropdown-menu .search-autocomplete-list {
    top: calc(100% + 8px);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.search-dropdown-menu .search-autocomplete-item {
    padding: 9px 16px;
    font-size: 14px;
    color: #242222;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s ease;
}

.search-dropdown-menu .search-autocomplete-item:hover {
    background: #f4f6f9;
}

.search-dropdown-menu .search-autocomplete-item strong {
    color: #3558b8;
    font-weight: 700;
}

/* Автокомплит на странице search.php */
.site-search-form .search-autocomplete-list {
    top: calc(100% + 8px);
    background: #ffffff;
    border: 1px solid var(--color-border, #E3E3E3);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.site-search-form .search-autocomplete-item {
    padding: 10px 20px;
    font-size: 15px;
    color: var(--color-text, #242222);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s ease;
}

.site-search-form .search-autocomplete-item:hover {
    background: #f5f7fa;
}

.site-search-form .search-autocomplete-item strong {
    color: #3558b8;
    font-weight: 700;
}
