/**
 * LIVZO — advanced search component.
 *
 * The bar carries two controls and the action: the "Society / Sector / Locality" search
 * dropdown (which is how a sector is looked up) and the "Location / City" filter.
 *
 * Layout modes (driven by the space the hero column actually has)
 *  - ≥1240px    : one row — Society / Sector / Locality | Location / City | Explore, the
 *                 search field taking ~60% of the bar
 *  - 620–1239px : the search field, then Location / City | Explore
 *  - <620px     : fully stacked
 */

/* ==========================================================================
   1. Heading
   ========================================================================== */

.lz-search {
    position: relative;
    max-width: 820px;
}

.lz-search__head {
    margin-bottom: 12px;
}

.lz-search__title {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.lz-search__sub {
    margin-top: 2px;
    color: var(--lz-muted);
    font-size: 0.85rem;
}

/* ==========================================================================
   2. The bar
   ========================================================================== */

.lz-search__bar {
    display: grid;
    /* The search field carries the bar (~60% of it); the city filter and the action
       share the rest. */
    grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr) auto;
    align-items: stretch;
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--lz-r-xl);
    background-image: linear-gradient(180deg, #ffffff 0%, #fdfdff 100%);
    box-shadow: 0 0 0 1px rgba(11, 27, 51, 0.05),
        0 2px 4px rgba(11, 27, 51, 0.04),
        0 26px 52px -30px rgba(11, 27, 51, 0.34);
    transition: box-shadow 0.4s var(--lz-ease);
}

/* Soft focus bloom when any part of the component is engaged */
.lz-search__bar:focus-within,
.lz-search__bar:hover {
    box-shadow: 0 0 0 1px rgba(11, 27, 51, 0.05),
        0 2px 4px rgba(11, 27, 51, 0.04),
        0 30px 60px -28px rgba(11, 27, 51, 0.38);
}

/* Highlights the form when the header search icon jumps to it */
.lz-search.is-pulsed .lz-search__bar {
    box-shadow: 0 0 0 4px var(--lz-accent-soft), 0 30px 60px -28px rgba(109, 74, 255, 0.5);
}

/* ==========================================================================
   3. Fields
   ========================================================================== */

.lz-field {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 8px 16px;
    border-radius: var(--lz-r-lg);
    transition: background-color var(--lz-t) var(--lz-ease), box-shadow var(--lz-t) var(--lz-ease);
}

.lz-field:hover,
.lz-field:focus-within {
    background-color: rgba(109, 74, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(109, 74, 255, 0.09);
}

/* Hairline separators between fields */
.lz-field + .lz-field::before {
    content: '';
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 1px;
    background-color: var(--lz-line);
}

/* The primary field wears a soft accent wash and a circled icon, so the eye lands on
   "where do you want to live" before the two filters beside it. */
.lz-field--society {
    background-image: linear-gradient(135deg, rgba(109, 74, 255, 0.055) 0%, rgba(109, 74, 255, 0.015) 62%);
}

.lz-field--society:hover,
.lz-field--society:focus-within {
    background-color: rgba(109, 74, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(109, 74, 255, 0.16);
}

.lz-field--society .lz-field__ico {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-image: linear-gradient(135deg, var(--lz-accent-soft) 0%, rgba(109, 74, 255, 0.18) 100%);
    color: var(--lz-accent-700);
}

.lz-field--society .lz-field__ico .lz-icon {
    width: 16px;
    height: 16px;
}

/* The city filter is the narrower control, so it runs on a slightly tighter rhythm than
   the search field beside it. */
.lz-field--select {
    padding: 8px 12px;
}

.lz-field--select .lz-field__body { gap: 8px; }

.lz-field--select .lz-field__ico .lz-icon {
    width: 16px;
    height: 16px;
}

.lz-field--select .lz-field__value { font-size: 0.9rem; }

.lz-field__label {
    display: block;
    margin-bottom: 1px;
    overflow: hidden;
    color: var(--lz-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.075em;
    text-transform: uppercase;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lz-field__body {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 26px;
    min-width: 0;
}

/* ==========================================================================
   4. Location / sector trigger
   ========================================================================== */

.lz-field__trigger {
    display: none;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}

.has-js .lz-field__trigger { display: flex; }

.lz-field__ico {
    display: grid;
    place-items: center;
    flex: none;
    color: var(--lz-accent);
}

.lz-field__ico .lz-icon {
    width: 18px;
    height: 18px;
}

.lz-field__value {
    min-width: 0;
    overflow: hidden;
    color: var(--lz-navy);
    font-size: 0.94rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lz-field__value.is-muted {
    color: var(--lz-muted);
    font-weight: 500;
}

.lz-field__chev {
    display: grid;
    place-items: center;
    margin-left: auto;
    flex: none;
    color: var(--lz-muted);
    transition: transform var(--lz-t) var(--lz-ease), color var(--lz-t) var(--lz-ease);
}

.lz-field__chev .lz-icon {
    width: 16px;
    height: 16px;
}

.lz-field__trigger[aria-expanded="true"] .lz-field__chev {
    color: var(--lz-accent);
    transform: rotate(180deg);
}

/* No-JS fallback control (a <select>, or the search field's plain text input) */
.lz-field__native {
    display: block;
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--lz-line);
    border-radius: var(--lz-r-xs);
    background-color: #fff;
    color: var(--lz-navy);
    font-size: 0.95rem;
    font-weight: 600;
    -webkit-appearance: none;
    appearance: none;
}

.lz-field__native::placeholder {
    color: var(--lz-muted);
    font-weight: 500;
}

.has-js .lz-field__native { display: none; }

/* ==========================================================================
   5. Popover search field
   ========================================================================== */

.lz-popover__search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    height: 40px;
    margin: 4px 4px 6px;
    padding: 0 12px;
    border: 1px solid var(--lz-line);
    border-radius: var(--lz-r-sm);
    background-color: #fff;
    transition: border-color var(--lz-t) var(--lz-ease), box-shadow var(--lz-t) var(--lz-ease);
}

.lz-popover__search:focus-within {
    border-color: rgba(109, 74, 255, 0.34);
    box-shadow: 0 0 0 3px var(--lz-accent-soft);
}

.lz-popover__search-ico {
    display: grid;
    place-items: center;
    flex: none;
    color: var(--lz-muted);
}

.lz-popover__search-ico .lz-icon { width: 16px; height: 16px; }

.lz-popover__input {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--lz-navy);
    font-size: 0.93rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    outline: none;
}

.lz-popover__input::placeholder {
    color: var(--lz-muted);
    font-weight: 500;
}

.lz-popover__input::-webkit-search-cancel-button { display: none; }

.lz-field__clear {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background-color: rgba(11, 27, 51, 0.06);
    color: var(--lz-navy-2);
    cursor: pointer;
    transition: background-color var(--lz-t) var(--lz-ease), transform var(--lz-t) var(--lz-ease);
}

.lz-field__clear:hover {
    background-color: rgba(11, 27, 51, 0.12);
    transform: scale(1.06);
}

.lz-field__clear[hidden] { display: none; }
.lz-field__clear .lz-icon { width: 13px; height: 13px; }

/* ==========================================================================
   6. Submit
   ========================================================================== */

.lz-search__action {
    display: flex;
    align-items: center;
    padding: 3px;
}

.lz-search__submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 54px;
    padding: 0 19px;
    overflow: hidden;
    border: 0;
    border-radius: var(--lz-r-lg);
    background-image: linear-gradient(135deg, var(--lz-accent) 0%, var(--lz-accent-600) 58%, var(--lz-accent-700) 100%);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 13px 24px -16px rgba(109, 74, 255, 0.95);
    transition: transform var(--lz-t) var(--lz-ease), box-shadow var(--lz-t) var(--lz-ease);
}

/* Light sweep on hover */
.lz-search__submit::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(110deg, transparent 28%, rgba(255, 255, 255, 0.34) 45%, transparent 62%);
    transform: translateX(-130%);
    transition: transform 0.75s var(--lz-ease-out);
    pointer-events: none;
}

.lz-search__submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 34px -16px rgba(109, 74, 255, 0.95);
}

.lz-search__submit:hover::after { transform: translateX(130%); }

.lz-search__submit:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 10px 20px -14px rgba(109, 74, 255, 0.9);
}

.lz-search__submit-ico { display: grid; place-items: center; }
.lz-search__submit-ico .lz-icon { width: 17px; height: 17px; }

/* ==========================================================================
   7. Popovers (dropdown + suggestions)
   ========================================================================== */

.lz-popover {
    position: absolute;
    z-index: 40;
    top: calc(100% + 13px);
    left: 0;
    min-width: 100%;
    max-height: min(348px, 62vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border: 1px solid var(--lz-line);
    border-radius: var(--lz-r-lg);
    background-color: rgba(255, 255, 255, 0.97);
    box-shadow: 0 34px 64px -26px rgba(11, 27, 51, 0.34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: lzPop 0.24s var(--lz-ease-out);
    transform-origin: top center;
}

.lz-popover[hidden] { display: none; }

.lz-popover--select { min-width: 216px; }

.lz-popover--suggest {
    right: auto;
    display: flex;
    flex-direction: column;
    width: max(100%, 352px);
    max-height: min(440px, 68vh);
    /* The search row stays put and the results scroll under it. */
    overflow: hidden;
}

.lz-popover__head {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: none;
    padding: 8px 12px 7px;
    color: var(--lz-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.lz-popover__head[hidden] { display: none; }

.lz-popover__state {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 13px;
    color: var(--lz-muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.lz-popover__state[hidden] { display: none; }

.lz-popover__state strong {
    display: block;
    color: var(--lz-navy);
    font-weight: 700;
}

.lz-popover__state .lz-icon {
    width: 17px;
    height: 17px;
    flex: none;
}

.lz-suggest__list {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
}

/* ==========================================================================
   8. Options
   ========================================================================== */

.lz-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--lz-r-sm);
    cursor: pointer;
    transition: background-color var(--lz-t-fast) var(--lz-ease), transform var(--lz-t-fast) var(--lz-ease);
}

.lz-option[hidden] { display: none; }

.lz-option:hover,
.lz-option.is-active {
    background-color: var(--lz-accent-soft);
}

.lz-option.is-active { transform: translateX(2px); }

.lz-option__ico {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    overflow: hidden;
    border: 1px solid var(--lz-line);
    border-radius: 11px;
    background-color: #fff;
    color: var(--lz-accent);
    transition: border-color var(--lz-t) var(--lz-ease), box-shadow var(--lz-t) var(--lz-ease);
}

.lz-option__ico .lz-icon { width: 17px; height: 17px; }

.lz-option:hover .lz-option__ico,
.lz-option.is-active .lz-option__ico {
    border-color: rgba(109, 74, 255, 0.3);
    box-shadow: 0 8px 16px -12px rgba(109, 74, 255, 0.75);
}

/* A society's own cover image, clipped to a circle so the row reads as "this place". */
.lz-option__ico--photo { border-radius: 50%; }

.lz-option__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* No cover image yet: a neutral monogram, so the circle never fakes a photo. */
.lz-option__mono {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(135deg, var(--lz-accent-soft) 0%, rgba(109, 74, 255, 0.18) 100%);
    color: var(--lz-accent-700);
    font-size: 0.9rem;
    font-weight: 700;
}

.lz-option__body {
    display: grid;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.lz-option__text {
    overflow: hidden;
    color: var(--lz-navy);
    font-size: 0.94rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lz-option__meta {
    overflow: hidden;
    color: var(--lz-muted);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lz-option__tag {
    flex: none;
    padding: 3px 9px;
    border: 1px solid var(--lz-line);
    border-radius: var(--lz-r-pill);
    background-color: rgba(11, 27, 51, 0.03);
    color: var(--lz-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* A result with a destination: the row navigates when chosen. */
.lz-option__go {
    display: inline-flex;
    flex: none;
    margin-left: 6px;
    color: var(--lz-accent);
    opacity: 0;
    transform: translateX(-3px);
    transition: opacity var(--lz-t) var(--lz-ease-out), transform var(--lz-t) var(--lz-ease-out);
}

.lz-option.is-linked.is-active .lz-option__go,
.lz-option.is-linked:hover .lz-option__go {
    opacity: 1;
    transform: none;
}

.lz-option__tick {
    display: grid;
    place-items: center;
    flex: none;
    color: var(--lz-accent);
    opacity: 0;
    transition: opacity var(--lz-t-fast) var(--lz-ease);
}

.lz-option__tick .lz-icon { width: 16px; height: 16px; }

.lz-option[aria-selected="true"] .lz-option__tick { opacity: 1; }
.lz-option[aria-selected="true"] .lz-option__text { color: var(--lz-accent-700); }

/* ==========================================================================
   9. Responsive
   ========================================================================== */

/* Below one row the bar becomes cards: the search field keeps the full width, so its
   dropdown panel and its own search box never get squeezed, and the city filter sits
   beside the action. */
@media (max-width: 1239px) {
    .lz-search { max-width: 100%; }

    .lz-search__bar {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 10px;
    }

    .lz-field {
        border: 1px solid var(--lz-line);
        background-color: #fff;
    }

    .lz-field + .lz-field::before { display: none; }

    .lz-field--society { grid-column: 1 / -1; }

    .lz-search__action { padding: 2px; }

    .lz-search__submit { min-height: 52px; }

    .lz-popover--suggest { width: 100%; }
}

/* Mobile: everything stacks, the action stays first-class. */
@media (max-width: 619px) {
    .lz-search__bar { grid-template-columns: 1fr; }

    .lz-field { padding: 10px 14px; }

    .lz-popover {
        left: 0;
        right: 0;
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 420px) {
    .lz-search__bar { padding: 10px; }
    .lz-field { padding: 9px 13px; }
    .lz-search__submit { min-height: 50px; padding: 0 16px; }
}
