/* ========================================
   SEARCH PAGE — public/css/site/search.css
   ======================================== */

.search-page {
    padding: 90px 0 60px;
    background: var(--bg);
    min-height: 80vh;
}

.search-page__top {
    margin-bottom: 24px;
}

.search-page__title {
    margin: 0 0 6px;
    font-size: 32px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.15;
}

.search-page__subtitle {
    margin: 0;
    color: #6f7b93;
    font-size: 14px;
}

/* ====== LAYOUT ====== */

.search-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.search-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* position: sticky; */
    /* top: 80px; */
}

.search-sidebar__card {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(15,29,68,0.07);
}

/* ====== SEARCH BOX ====== */

.search-search-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* S-FIELD */

.s-field {
    position: relative;
}

.s-field__inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--light);
    border: 1.5px solid transparent;
    border-radius: 14px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
    min-height: 56px;
}

.s-field.is-open .s-field__inner,
.s-field__inner:focus-within {
    border-color: var(--blue);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(54,154,227,0.08);
}

.s-field__icon {
    color: var(--slate-50);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.s-field__content {
    flex: 1;
    min-width: 0;
}

.s-field__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--slate-50);
    margin-bottom: 2px;
    white-space: nowrap;
}

.s-field__input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
    padding: 0;
}

.s-field__input::placeholder { color: var(--slate-50); }

.s-field__display {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.s-field__display.is-empty { color: var(--slate-50); }

.s-field__clear {
    width: 22px; height: 22px;
    border-radius: 999px;
    border: none;
    background: rgba(64,83,98,0.12);
    color: var(--slate);
    font-size: 14px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    transition: background .15s ease;
}

.s-field__clear:hover { background: rgba(64,83,98,0.22); }

/* S-POPUP */

.s-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 60;
    background: #ffffff;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 16px 48px rgba(15,29,68,0.18);
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    border: 1px solid #f1f5f9;
}

.s-field.is-open .s-popup {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Calendar popup — extends to the right over main content */
.s-popup--cal {
    left: 0;
    right: auto;
    min-width: 580px;
    padding: 16px;
}

.s-popup__loading {
    font-size: 13px;
    color: var(--slate-50);
    padding: 4px 0;
}

.s-popup__empty {
    font-size: 13px;
    color: var(--slate-50);
    padding: 4px 0;
}

.s-popup__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 220px;
    overflow-y: auto;
}

.s-popup__list::-webkit-scrollbar { width: 4px; }
.s-popup__list::-webkit-scrollbar-thumb { background: #dde2ee; border-radius: 999px; }

/* ====== FIND BUTTON ====== */

.search-find-btn {
    height: 52px;
    border: none;
    border-radius: 14px;
    background: var(--orange);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .2s ease, transform .2s ease;
    position: relative;
    overflow: hidden;
}

.search-find-btn:hover {
    background: var(--orange-h);
    transform: translateY(-1px);
}

/* @keyframes searchBtnShimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

.search-find-btn.is-live {
    background: linear-gradient(
        120deg,
        var(--orange)               20%,

        rgb(246, 151, 111)                     50%,

        var(--orange)               80%
    );
    background-size: 300% auto;
    animation: searchBtnShimmer 3.8s linear infinite;
} */

/* ====== FILTERS CARD ====== */

.search-sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.search-sidebar__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

.search-reset-all,
.search-reset-link {
    border: none;
    background: transparent;
    padding: 0;
    color: var(--blue);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.search-filter-block {
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
}

.search-filter-block:first-child {
    border-top: none;
    padding-top: 0;
}

.search-filter-block__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

/* Range */
.search-range-box { display: flex; flex-direction: column; gap: 12px; }

.search-range-inputs {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    background: var(--light);
    border: 1px solid #e8eaf2;
    border-radius: 12px;
    overflow: hidden;
}

.search-range-divider { background: #e8eaf2; width: 1px; }

.search-range-input { padding: 8px 12px; }

.search-range-input label {
    display: block;
    font-size: 11px;
    color: var(--slate-50);
    margin-bottom: 3px;
}

.search-range-input input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
}

/* Dual range slider */
.search-dual-range { position: relative; height: 28px; }

.search-dual-range__track,
.search-dual-range__fill {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    border-radius: 999px;
}

.search-dual-range__track { left: 0; right: 0; background: #e8eaf2; }
.search-dual-range__fill  { background: var(--blue); }

.search-dual-range input[type="range"] {
    position: absolute;
    left: 0; top: 0;
    width: 100%; height: 28px;
    margin: 0;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

.search-dual-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--blue);
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(54,154,227,0.3);
    pointer-events: auto;
    cursor: pointer;
}

.search-dual-range input[type="range"]::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--blue);
    border: 2px solid #fff;
    pointer-events: auto;
    cursor: pointer;
}

/* Checkboxes */
.search-check-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 2px;
}

.search-check-grid::-webkit-scrollbar { width: 4px; }
.search-check-grid::-webkit-scrollbar-thumb { background: #dde2ee; border-radius: 999px; }

.search-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--dark);
    cursor: pointer;
}

.search-check-item input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--blue);
    flex-shrink: 0;
}

/* ====== RESULTS ====== */

.search-results__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.search-results__count {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
}

.search-results__sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-results__sort label {
    font-size: 13px;
    color: var(--slate-50);
    white-space: nowrap;
}

.search-sort-select {
    appearance: none;
    -webkit-appearance: none;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23405362' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    background-size: 14px;
    border: 1.5px solid #e8eaf2;
    border-radius: 12px;
    padding: 9px 36px 9px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
    outline: none;
    cursor: pointer;
    min-width: 175px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.search-sort-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(54,154,227,0.1);
}

/* Results body */
.search-results__body {
    position: relative;
    min-height: 200px;
}

/* Loader */
.search-loader {
    display: flex;
    position: absolute;
    inset: 0;
    background: rgba(244,245,251,0.7);
    z-index: 4;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    backdrop-filter: blur(0px);
    transition: opacity .3s ease, visibility .3s ease, backdrop-filter .3s ease;
}

.search-loader.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}

.search-loader__spinner {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 3px solid #e8eaf2;
    border-top-color: var(--blue);
    animation: searchSpin 1s linear infinite;
}

@keyframes searchSpin { to { transform: rotate(360deg); } }

.search-cards-grid,
.search-other-block,
.search-empty {
    transition: opacity .3s ease, transform .3s ease, filter .3s ease;
}

.search-results__body:has(.search-loader.is-active) .search-cards-grid,
.search-results__body:has(.search-loader.is-active) .search-other-block,
.search-results__body:has(.search-loader.is-active) .search-empty {
    opacity: 0.4;
    transform: translateY(3px);
    filter: blur(1px);
}

.search-empty {
    background: #ffffff;
    border-radius: 18px;
    padding: 20px 22px;
    font-size: 14px;
    color: #64748b;
}

.search-other-block { margin-top: 28px; }

.search-other-block__title {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

/* Cards grid */
.search-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

/* Show more */
.search-results__footer {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.search-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 28px;
    border-radius: 14px;
    border: 1.5px solid #e8eaf2;
    background: #ffffff;
    color: var(--dark);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
    box-shadow: 0 2px 8px rgba(15,29,68,0.06);
}

.search-more-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: rgba(54,154,227,0.04);
    transform: translateY(-1px);
}

/* Scroll top */
.search-scroll-top-btn {
    position: fixed;
    right: 32px;
    bottom: 32px;
    width: 44px; height: 44px;
    border: 1.5px solid #e8eaf2;
    border-radius: 14px;
    background: #ffffff;
    color: var(--slate);
    font-size: 18px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
    cursor: pointer;
    z-index: 3;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-scroll-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-scroll-top-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

/* ====== MOBILE FILTER BUTTON ====== */

.search-mobile-filter-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: fixed;
    bottom: calc(22px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1180;
    border: 1.5px solid var(--blue);
    border-radius: 14px;
    background: #ffffff;
    color: var(--blue);
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(54,154,227,0.2);
    white-space: nowrap;
    transition: background .2s ease, opacity .25s ease, transform .25s ease;
}

.search-mobile-filter-btn:hover {
    /* background: rgba(54,154,227,0.06); */

    background: rgba(255, 255, 255,0.9);
}

.search-mobile-filter-btn__badge {
    min-width: 20px; height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--blue);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.search-mob-open .search-mobile-filter-btn {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(16px);
}

/* ====== MOBILE FULL-SCREEN MODAL ====== */

body.search-mob-open { overflow: hidden; }

.search-mob-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    background: transparent;
    visibility: hidden;
    pointer-events: none;
}

.search-mob-modal.is-open {
    visibility: visible;
    pointer-events: auto;
}

.search-mob-modal__inner {
    background: #ffffff;
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.32,.72,0,1);
    overflow: hidden;
}

.search-mob-modal .sf-check-grid {
    max-height: none;
    overflow-y: visible;
}

.search-mob-modal.is-open .search-mob-modal__inner {
    transform: translateY(0);
}

.search-mob-modal__inner {
    background: #ffffff;
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.32,.72,0,1);
    overflow: hidden;
}

.search-mob-modal.is-open .search-mob-modal__inner {
    transform: translateY(0);
}

.search-mob-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    gap: 10px;
}

.search-mob-modal__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark);
    flex: 1;
}

.search-mob-modal__close {
    width: 36px; height: 36px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    font-size: 22px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.search-mob-modal__search-row {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.search-mob-modal__search-input {
    width: 100%;
    height: 48px;
    border-radius: 14px;
    border: 1.5px solid #e5e7eb;
    padding: 0 16px;
    font-size: 16px;
    outline: none;
    background: #f8f9fc;
    color: var(--dark);
}

.search-mob-modal__search-input:focus {
    border-color: var(--blue);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(54,154,227,0.1);
}

.search-mob-modal__body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px;
}

.search-mob-modal__footer {
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
    display: flex;
    gap: 10px;
}

.search-mob-modal__apply-btn {
    flex: 1;
    height: 52px;
    border: none;
    border-radius: 14px;
    background: var(--orange);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s ease;
}

.search-mob-modal__apply-btn:hover { background: var(--orange-h); }

.search-mob-modal__reset-btn {
    height: 52px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1.5px solid #e5e7eb;
    background: #f9fafb;
    color: var(--slate);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ====== RESPONSIVE ====== */

@media (max-width: 1200px) {
    .search-layout { grid-template-columns: 280px minmax(0, 1fr); }
    .search-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .search-page { padding-top: 90px; }

    .search-layout { display: block; }

    .search-sidebar {
        position: static;
        margin-bottom: 16px;
    }

    /* Filter card hidden on mobile — shown in full-screen modal */
    .search-sidebar__card--filters { display: none; }

    .search-mobile-filter-btn { display: flex; }

    .search-results__head { align-items: stretch; }

    .search-results__sort {
        width: 100%;
        justify-content: space-between;
    }

    .search-sort-select {
        min-width: 0;
        flex: 1;
    }

    .search-results__footer { padding-bottom: 80px; }

    /* Direction popup full width on mobile handled via JS modal */
    .s-popup--cal { min-width: unset; left: 0; right: 0; }
}

@media (max-width: 640px) {
    .search-page__title { font-size: 24px; }
    .search-cards-grid { grid-template-columns: 1fr; }

    .search-scroll-top-btn {
        right: 24px;
        bottom: 24px;
    }
}