/**
 * Site-wide header search below the logo / nav row.
 * Desktop (992+): brand pill. Mobile / tablet: slim rounded bar.
 * Width follows --ch-page-max / --ch-page-gutter from ch-page-width.css.
 * Stays in document flow inside the sticky header so it cannot cover the
 * in-flow visitor location picker (Use GPS / Change location).
 */
.ch-site-search-row {
    width: 100%;
    position: relative;
    z-index: 20;
    padding: 0.4rem 0 0.5rem;
    border-top: 1px solid #f1f5f9;
}

@media (min-width: 992px) {
    .ch-site-search-row {
        padding: 0.45rem 0 0.55rem;
    }
}

.ch-site-search-form {
    position: relative;
    width: 100%;
    min-width: 0;
    margin: 0;
}

.ch-site-search {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: #fff;
    border: 1.5px solid var(--brand-primary, #018D12);
    border-radius: 999px;
    padding: 0.18rem 0.18rem 0.18rem 0.1rem;
    min-height: 2.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.ch-site-search:focus-within {
    box-shadow: 0 0 0 3px rgba(1, 141, 18, 0.12);
}

.ch-site-search__icon {
    color: #94a3b8;
    font-size: 0.95rem;
    flex-shrink: 0;
    padding-left: 0.7rem;
    line-height: 1;
}

.ch-site-search__input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: #0f172a;
    padding: 0.32rem 0.25rem;
    -webkit-appearance: none;
    appearance: none;
}

.ch-site-search__input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.ch-site-search__input::-webkit-search-decoration,
.ch-site-search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.ch-site-search__submit {
    position: relative;
    flex-shrink: 0;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: auto;
    height: auto;
    min-width: 2.1rem;
    min-height: 0;
    aspect-ratio: 1 / 1;
    padding: 0;
    background: var(--brand-primary, #018D12);
    color: #fff;
    border: none;
    border-radius: 0.55rem;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s ease;
}

.ch-site-search__submit:hover {
    background: var(--brand-primary-dark, #01660D);
    color: #fff;
}

.ch-site-search__submit:focus-visible {
    outline: 2px solid var(--brand-primary, #018D12);
    outline-offset: 2px;
}

.ch-site-search__submit-icon {
    display: block;
    font-size: 1.05rem;
    line-height: 1;
    color: #fff;
}

/* Desktop pill: must follow base .ch-site-search / __submit so it wins. */
@media (min-width: 992px) {
    .ch-site-search {
        align-items: center;
        gap: 0.2rem;
        padding: 0 0 0 0.1rem;
    }

    .ch-site-search__input {
        align-self: center;
        padding: 0.45rem 0.4rem 0.45rem 0.25rem;
    }

    .ch-site-search__icon {
        align-self: center;
    }

    .ch-site-search__submit {
        flex: 0 0 2.5rem;
        align-self: stretch;
        width: 2.5rem;
        min-width: 2.5rem;
        height: auto;
        min-height: 0;
        aspect-ratio: auto;
        margin: 0;
        padding: 0;
        border-radius: 0 999px 999px 0;
        -webkit-appearance: none;
        appearance: none;
    }
}

.ch-site-search-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.4rem);
    z-index: 30;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.45rem 0 0.55rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
    max-height: min(70dvh, 32rem);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.ch-site-search-panel[hidden] {
    display: none !important;
}

.ch-site-search-panel__status,
.ch-site-search-panel__empty {
    padding: 0.85rem 1.05rem;
    font-size: 0.88rem;
    color: #64748b;
}

.ch-site-search-group {
    padding: 0.15rem 0 0.35rem;
}

.ch-site-search-group + .ch-site-search-group {
    border-top: 1px solid #f1f5f9;
    margin-top: 0.25rem;
    padding-top: 0.4rem;
}

.ch-site-search-group__title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.35rem 1.05rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.ch-site-search-group__title i {
    color: var(--brand-primary, #018D12);
    font-size: 0.85rem;
}

.ch-site-search-group__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ch-site-search-hit {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    width: 100%;
    padding: 0.55rem 1.05rem;
    text-decoration: none;
    color: #0f172a;
    box-sizing: border-box;
}

.ch-site-search-hit:hover,
.ch-site-search-hit.is-active {
    background: #E8F8EA;
    color: #0f172a;
}

.ch-site-search-hit:focus-visible {
    outline: 2px solid var(--brand-primary, #018D12);
    outline-offset: -2px;
}

.ch-site-search-hit__name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}

.ch-site-search-hit__sub {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.35;
}

.ch-site-search-group__more {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0.15rem 1.05rem 0.2rem;
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--brand-primary, #018D12);
    text-decoration: none;
}

.ch-site-search-group__more:hover {
    text-decoration: underline;
}

/* Mobile + tablet header stack (< lg): slim full-width bar under the logo.
   Public desktop search (lg+) keeps the green pill above. */
@media (max-width: 991.98px) {
    .ch-site-search-row {
        padding: 0.15rem 0 0.6rem;
        border-top: none;
    }

    .ch-site-search {
        min-height: 2.5rem;
        gap: 0.35rem;
        padding: 0.15rem 0.15rem 0.15rem 0.65rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.5rem;
        background: #f1f5f9;
        box-shadow: none;
    }

    .ch-site-search:focus-within {
        background: #fff;
        border-color: rgba(1, 141, 18, 0.45);
        box-shadow: 0 0 0 3px rgba(1, 141, 18, 0.12);
    }

    .ch-site-search__icon {
        padding-left: 0;
        font-size: 1rem;
        color: #64748b;
    }

    .ch-site-search__input {
        flex: 1 1 0%;
        width: auto;
        min-width: 0;
        overflow: hidden;
        font-size: 16px;
        font-weight: 400;
        line-height: 1.3;
        padding: 0.45rem 0.2rem;
        letter-spacing: -0.01em;
    }

    .ch-site-search__input::placeholder {
        color: #94a3b8;
        font-weight: 400;
    }

    .ch-site-search__submit {
        flex: 0 0 auto;
        align-self: stretch;
        position: relative;
        z-index: 1;
        width: auto;
        height: auto;
        min-width: 2.15rem;
        min-height: 0;
        padding: 0;
        border-radius: 0.5rem;
        background-color: var(--brand-primary, #018D12);
        color: #fff;
    }

    .ch-site-search-panel {
        position: absolute;
        top: calc(100% + 0.35rem);
        max-height: min(60dvh, calc(100dvh - 8rem));
        border-radius: 0.65rem;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .ch-site-search-row {
        padding: 0.3rem 0 0.65rem;
    }
}

@media (max-width: 575.98px) {
    .auth-drawer-topbar .auth-topbar-main {
        padding-bottom: 0.15rem;
        min-height: 0;
    }

    .ch-site-search-row {
        padding: 0.05rem 0 0.55rem;
    }

    .ch-site-search {
        min-height: 2.5rem;
        padding: 0.1rem 0.1rem 0.1rem 0.7rem;
        gap: 0.25rem;
        border-radius: 0.5rem;
    }

    .ch-site-search__input {
        padding: 0.45rem 0.1rem;
    }

    .ch-site-search__submit {
        flex: 0 0 auto;
        align-self: stretch;
        position: relative;
        z-index: 1;
        width: auto;
        height: auto;
        min-width: 2.2rem;
        min-height: 0;
        padding: 0;
        border-radius: 0.5rem;
        background-color: var(--brand-primary, #018D12);
        color: #fff;
    }

    .ch-site-search-panel {
        max-height: min(55dvh, calc(100dvh - 7.5rem));
        border-radius: 0.65rem;
    }
}
