/* ==========================================================
   Property search bar (template-parts/property-search.php)
   Used on the property archive (live filters) and anywhere the
   [tb_property_search] shortcode / Property Search block is placed.
   ========================================================== */

/* ---------- Search / filter bar ---------- */
.tb-prop-search {
    --tbp-gold: #c4943f;
    --tbp-sans: 'Raleway', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 28px 0 32px;
    background: #161719;
    font-family: var(--tbp-sans);
    box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .35);
}
.tb-prop-search__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center; /* center the fields in the bar */
    gap: 18px;
    @media (min-width: 1000px) {
  .tb-prop-search__inner { max-width: 1140px; flex-wrap: nowrap; align-items: flex-end; }
  .tb-prop-search__field { flex: 1 1 0; min-width: 0; }
  .tb-prop-search__field--beds,
  .tb-prop-search__field--submit { flex: 0 0 auto; }
}
}
/* Wide screens: give the bar extra room so every filter, Has specials
   and Reset sit on one row. */
@media (min-width: 1200px) {
    .tb-prop-search__inner.container {
        max-width: 1360px;
        flex-wrap: nowrap;
        gap: 16px;
    }
}
.tb-prop-search__field {
    flex: 0 1 188px;
    min-width: 160px;
}
.tb-prop-search__field--beds {
    flex: 0 1 auto;
}
.tb-prop-search__label {
    display: block;
    margin: 0 0 8px;
    color: var(--tbp-gold);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.tb-prop-search__control {
    position: relative;
    display: flex;
    align-items: center;
    height: 50px;
    background: #ffffff;
    border-radius: 6px;
}
.tb-prop-search__control > .fa-solid,
.tb-prop-search__control > .fa-regular {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tbp-gold);
    font-size: 15px;
    pointer-events: none;
}
.tb-prop-search__control select {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 38px 0 46px;
    border: 0;
    border-radius: 6px;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.4 0 6 4.6 10.6 0 12 1.4l-6 6-6-6z' fill='%23161719'/%3E%3C/svg%3E") no-repeat right 14px center;
    color: #161719;
    font-family: var(--tbp-sans);
    font-size: 15px;
    font-weight: 500;
    line-height: 50px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.tb-prop-search__control select:focus-visible,
.tb-prop-search__bed:focus-visible {
    outline: 2px solid var(--tbp-gold);
    outline-offset: 2px;
}

/* Bedrooms segmented control */
.tb-prop-search__beds {
    gap: 4px;
    padding: 0 6px 0 42px;
}
.tb-prop-search__bed {
    min-width: 50px;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #161719;
    font-family: var(--tbp-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.tb-prop-search__bed:hover {
    background: #f3eee4;
}
.tb-prop-search__bed.is-active {
    background: var(--tbp-gold);
    color: #161719;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}

/* "Has specials" toggle: outlined pill, gold when on */
.tb-prop-search__field--specials {
    flex: 0 0 auto;
    min-width: 0;
}
.tb-prop-search__toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 50px;
    padding: 0 18px 0 12px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 6px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.tb-prop-search__toggle input {
    /* visually hidden, still focusable and announced as a checkbox */
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}
.tb-prop-search__toggle-ui {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: var(--tbp-gold);
    font-size: 12px;
    transition: background-color .15s ease, color .15s ease;
}
.tb-prop-search__toggle:hover {
    border-color: var(--tbp-gold);
}
.tb-prop-search__toggle:has(input:focus-visible) {
    outline: 2px solid var(--tbp-gold);
    outline-offset: 2px;
}
.tb-prop-search__toggle:has(input:checked) {
    background: var(--tbp-gold);
    border-color: var(--tbp-gold);
    color: #161719;
}
.tb-prop-search__toggle:has(input:checked) .tb-prop-search__toggle-ui {
    background: #161719;
    color: var(--tbp-gold);
}

/* Reset */
.tb-prop-search__field--reset {
    flex: 0 0 auto;
    min-width: 0;
}
.tb-prop-search__reset {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 50px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 6px;
    background: transparent;
    color: #ffffff;
    font-family: var(--tbp-sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, opacity .15s ease;
}
.tb-prop-search__reset:hover:not(:disabled) {
    border-color: var(--tbp-gold);
    color: var(--tbp-gold);
}
.tb-prop-search__reset:focus-visible {
    outline: 2px solid var(--tbp-gold);
    outline-offset: 2px;
}
.tb-prop-search__reset:disabled {
    opacity: .4;
    cursor: default;
}

/* Search button (link mode: submits to the property archive) */
.tb-prop-search__field--submit {
    flex: 0 0 auto;
    min-width: 0;
}
.tb-prop-search__submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 50px;
    padding: 0 26px;
    border: 1px solid var(--tbp-gold);
    border-radius: 6px;
    background: var(--tbp-gold);
    color: #161719;
    font-family: var(--tbp-sans);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.tb-prop-search__submit:hover {
    background: transparent;
    color: var(--tbp-gold);
}
.tb-prop-search__submit:focus-visible {
    outline: 2px solid var(--tbp-gold);
    outline-offset: 2px;
}

/* Fields wrapper: invisible to the layout on desktop (fields sit in the row as before) */
.tb-prop-search__fields {
    display: contents;
}

/* Filters toggle and "Find your home" title: phones only */
.tb-prop-search__toggle-btn,
.tb-prop-search__title {
    display: none;
}

@media (max-width: 800px) {
    .tb-prop-search {
        padding: 24px 0;
    }
    .tb-prop-search__inner {
        justify-content: flex-start; /* phones: Filters button stays left */
        gap: 14px;
    }

    /* "Find your home" (home page): beside the Filters button */
    .tb-prop-search__title {
        display: block;
        flex: 1 1 0; /* shrinks (wraps to 2 lines) on very narrow phones instead of pushing the button down */
        min-width: 0;
        align-self: center;
        margin: 0;
        color: #ffffff;
        font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
        font-size: 28px;
        font-weight: 500;
        line-height: 1.15;
        letter-spacing: 0;
        text-transform: none;
    }

    .tb-prop-search.has-toggle .tb-prop-search__toggle-btn {
        display: inline-flex;
        flex-shrink: 0;
        align-self: center;
        align-items: center;
        gap: 14px;
        height: 54px;
        padding: 0 28px 0 24px;
        border: 0;
        border-radius: 999px;
        background: #ffffff;
        color: #161719;
        font-family: var(--tbp-sans);
        font-size: 17px;
        font-weight: 500;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
        transition: background-color .15s ease;
    }
    .tb-prop-search__toggle-btn i {
        color: var(--tbp-gold);
        font-size: 18px;
    }
    .tb-prop-search__toggle-btn:hover {
        background: #f3eee4;
    }
    .tb-prop-search__toggle-btn:focus-visible {
        outline: 2px solid var(--tbp-gold);
        outline-offset: 3px;
    }
    /* Number of active filters */
    .tb-prop-search__count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        margin-left: -4px;
        padding: 0 6px;
        border-radius: 999px;
        background: var(--tbp-gold);
        color: #161719;
        font-size: 12px;
        font-weight: 700;
    }
    .tb-prop-search__count[hidden] {
        display: none;
    }

    /* Fields hidden until Filters is tapped (only once the script has set the button up) */
    .tb-prop-search__fields {
        display: flex;
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 14px;
        padding-top: 6px;
    }
    .tb-prop-search.has-toggle .tb-prop-search__fields {
        display: none;
    }
    .tb-prop-search.is-open .tb-prop-search__fields {
        display: flex;
    }
    .tb-prop-search__field,
    .tb-prop-search__field--beds,
    .tb-prop-search__field--specials,
    .tb-prop-search__field--reset,
    .tb-prop-search__field--submit {
        flex: 1 1 100%;
    }
    .tb-prop-search__reset,
    .tb-prop-search__submit,
    .tb-prop-search__toggle {
        width: 100%;
        justify-content: center;
    }
    .tb-prop-search__beds {
        justify-content: space-between;
    }
    .tb-prop-search__bed {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 6px;
    }
}
