/* === Поиск по сайту: иконка-лупа в шапке + dropdown с результатами === */

.site-search { position: relative; display: inline-flex; margin-right: 32px; }
@media (max-width: 700px) {
    /* Абсолютное позиционирование — поиск не влияет на флекс-разметку, бургер всегда виден.
       НЕ используем transform на родителе — он ломает position:fixed у dropdown-панели. */
    .site-search {
        position: absolute;
        right: 60px;
        top: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        margin-right: 0;
        z-index: 5;
    }
    .site-search__toggle {
        min-width: 170px;
        justify-content: flex-start;
        padding-left: 14px;
    }
}

.site-search__toggle {
    background: linear-gradient(135deg, #ff7a4f, #f35c50);
    border: 0;
    padding: 10px 20px 10px 16px;
    color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; gap: 10px;
    border-radius: 999px;
    font: inherit; font-weight: 700; font-size: 13px;
    box-shadow: 0 3px 12px rgba(243, 92, 80, 0.35);
    transition: transform .15s, box-shadow .2s, filter .2s;
}
.site-search__toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(243, 92, 80, 0.45);
    filter: brightness(1.05);
}
.site-search.is-open .site-search__toggle {
    box-shadow: 0 6px 18px rgba(243, 92, 80, 0.5);
}
.site-search__lupa { stroke: currentColor; flex-shrink: 0; }

/* Анимированный ротатор слов рядом с лупой */
.site-search__rotator {
    position: relative;
    display: inline-block;
    height: 1em; min-width: 11ch;
    overflow: hidden;
    vertical-align: middle;
    line-height: 1;
}
.site-search__rotator-word {
    position: absolute; left: 0; top: 0;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(100%);
    animation: ssRotate 12s linear infinite;
}
.site-search__rotator-word:nth-child(1) { animation-delay:  0s; }
.site-search__rotator-word:nth-child(2) { animation-delay:  2.4s; }
.site-search__rotator-word:nth-child(3) { animation-delay:  4.8s; }
.site-search__rotator-word:nth-child(4) { animation-delay:  7.2s; }
.site-search__rotator-word:nth-child(5) { animation-delay:  9.6s; }
@keyframes ssRotate {
    0%   { opacity: 0; transform: translateY(100%); }
    4%   { opacity: 1; transform: translateY(0); }
    16%  { opacity: 1; transform: translateY(0); }
    20%  { opacity: 0; transform: translateY(-100%); }
    100% { opacity: 0; transform: translateY(-100%); }
}

/* Mobile: ротатор остаётся видимым, чуть компактнее */
@media (max-width: 700px) {
    .site-search__toggle { padding: 9px 14px 9px 12px; font-size: 10px; gap: 6px; }
    .site-search__rotator { min-width: 12ch; } /* "Апартаменты"/"Развлечения" = 11 символов */
    .site-search__lupa { width: 18px; height: 18px; }
}
@media (max-width: 380px) {
    .site-search__rotator { min-width: 7ch; font-size: 12px; }
}

.site-search__panel {
    position: absolute; top: calc(100% + 12px); right: 0;
    width: 460px; max-width: calc(100vw - 24px);
    background: #fff; border: 1px solid #ebedf0; border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.06);
    z-index: 9990;
    overflow: hidden;
    animation: ssDropIn .22s cubic-bezier(.4,0,.2,1);
}
.site-search__panel::before {
    content: '';
    position: absolute; top: -8px; right: 22px;
    width: 16px; height: 16px;
    background: #fff;
    border: 1px solid #ebedf0;
    border-right: 0; border-bottom: 0;
    transform: rotate(45deg);
    border-top-left-radius: 4px;
}
.site-search__panel[hidden] { display: none; }
@keyframes ssDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.site-search__input-wrap {
    position: relative; display: flex; align-items: center;
    padding: 18px 16px 18px 50px;
    background: linear-gradient(180deg, #fff5f4 0%, #fff 100%);
    border-bottom: 1px solid #ebedf0;
}
.site-search__icon {
    position: absolute; left: 18px;
    color: #f35c50; pointer-events: none;
}
.site-search__input {
    flex: 1; border: 0; outline: none; font: inherit; font-size: 16px;
    background: transparent; color: #1a1a1a; font-weight: 500;
    padding: 0 36px 0 0;
}
.site-search__input::placeholder { color: #b6b9bf; font-weight: 400; }
.site-search__close {
    position: absolute; right: 12px;
    background: rgba(0, 0, 0, 0.06); border: 0; cursor: pointer;
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 22px; color: #6b7280; line-height: 1;
    transition: background .15s, color .15s, transform .15s;
}
.site-search__close:hover { background: #f35c50; color: #fff; transform: rotate(90deg); }

.site-search__results { max-height: 60vh; overflow-y: auto; }
.site-search__results::-webkit-scrollbar { width: 8px; }
.site-search__results::-webkit-scrollbar-track { background: #fafafa; }
.site-search__results::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }
.site-search__results::-webkit-scrollbar-thumb:hover { background: #d1d5db; }

.site-search__hint, .site-search__loading, .site-search__empty {
    padding: 28px 18px; text-align: center; color: #9ca3af; font-size: 13px;
    line-height: 1.5;
}
.site-search__empty { font-size: 14px; }
.site-search__loading::before {
    content: '⟳'; display: inline-block; margin-right: 6px;
    animation: ssSpin 1s linear infinite;
}
@keyframes ssSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.ss-group { padding: 4px 0; }
.ss-group + .ss-group { border-top: 1px solid #f3f4f6; }
.ss-group-head {
    padding: 12px 18px 6px;
    font-size: 11px; font-weight: 700;
    color: #6b7280; text-transform: uppercase; letter-spacing: 0.06em;
    display: flex; align-items: center; gap: 8px;
    background: #fafbfc;
}
.ss-group-head .ss-icon { font-size: 14px; }
.ss-group-head .ss-count {
    font-weight: 600; color: #f35c50;
    background: #fff; padding: 2px 8px; border-radius: 99px;
    font-size: 10px; margin-left: auto;
}
.ss-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 18px;
    text-decoration: none; color: inherit;
    transition: background .15s, padding .15s;
    position: relative;
}
.ss-item:hover, .ss-item:focus {
    background: linear-gradient(90deg, #fff5f4 0%, #fff 100%);
    outline: none;
    padding-left: 22px;
}
.ss-item:hover::before {
    content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; background: #f35c50; border-radius: 0 3px 3px 0;
}
.ss-item-thumb {
    width: 44px; height: 44px; border-radius: 10px;
    object-fit: cover; background: #f3f4f6; flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.ss-item-thumb--fallback {
    display: grid; place-items: center; font-size: 22px;
}
.ss-item-text { min-width: 0; flex: 1; }
.ss-item-name {
    font-size: 14px; font-weight: 600; color: #1a1a1a; line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
}
.ss-item-arrow {
    color: #d1d5db; flex-shrink: 0; opacity: 0;
    transition: opacity .15s, transform .15s;
}
.ss-item:hover .ss-item-arrow { opacity: 1; transform: translateX(3px); color: #f35c50; }
.ss-item mark { background: #fff5f4; color: #f35c50; padding: 0 3px; border-radius: 3px; font-weight: 700; }

.site-search__footer {
    padding: 14px 18px;
    border-top: 1px solid #ebedf0;
    text-align: center;
    background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
}
.site-search__all {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px;
    font-size: 13px; font-weight: 700;
    color: #f35c50; text-decoration: none;
    background: rgba(243, 92, 80, 0.08);
    border-radius: 99px;
    transition: background .15s, transform .15s;
}
.site-search__all:hover { background: #f35c50; color: #fff; transform: translateY(-1px); }

/* Mobile: панель на полную ширину */
@media (max-width: 600px) {
    .site-search__panel {
        position: fixed; top: 70px; right: 8px; left: 8px; width: auto;
        max-width: none;
    }
    .site-search__panel::before { display: none; }
}
