/* 1. Suggestions sit directly below the homepage catalog search. */
:is(#agape-home, #agape-inner, .agape-product-banner) .agape-products__search { position: relative; z-index: 5; }
:is(#agape-home, #agape-inner, .agape-product-banner) .agape-search-results[hidden] { display: none !important; }
:is(#agape-home, #agape-inner, .agape-product-banner) .agape-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid #dce2ec;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(7, 26, 46, .16);
}
:is(#agape-home, #agape-inner, .agape-product-banner) .agape-search-results a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid #edf0f5;
    color: #0d2342;
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none;
}
:is(#agape-home, #agape-inner, .agape-product-banner) .agape-search-results small { color: #40516b; font-size: 12px; }
:is(#agape-home, #agape-inner, .agape-product-banner) .agape-search-results a:hover,
:is(#agape-home, #agape-inner, .agape-product-banner) .agape-search-results a:focus-visible { background: #fff7df; outline-offset: -3px; }
:is(#agape-home, #agape-inner, .agape-product-banner) .agape-search-results p { margin: 0; padding: 14px 16px; font-size: 13px; color: #40516b; }
:is(#agape-home, #agape-inner, .agape-product-banner) .agape-search-results a.agape-search-results__all {
    justify-content: center;
    background: #fff7df;
    font-weight: 700;
    border-bottom: 0;
}

/* 7. Match native and theme search templates to the homepage design. */
:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search {
    width: min(100%, 620px);
    margin: 0 auto 28px;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search form {
    display: flex;
    align-items: stretch;
    position: relative;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search label:not(.screen-reader-text) {
    flex: 1;
    min-width: 0;
    margin: 0;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search input[type="search"] {
    appearance: none;
    box-sizing: border-box;
    position: static;
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 46px;
    margin: 0;
    padding: 12px 16px;
    border: 1px solid #dce2ec;
    border-radius: 7px;
    background: #fff;
    color: #0d2342;
    box-shadow: 0 2px 3px #0d234208;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search input[type="search"]::placeholder {
    color: #62718a;
    opacity: 1;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search button,
:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search input[type="submit"] {
    appearance: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: static;
    inset: auto;
    flex: 0 0 auto;
    width: auto;
    min-width: 98px;
    height: 46px;
    min-height: 46px;
    margin: 0;
    padding: 10px 20px;
    border: 1px solid #d9ae36;
    border-radius: 7px;
    background: var(--ag-btn-gold, linear-gradient(180deg, #f6d878, #dfa92c));
    color: #081c35;
    box-shadow: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: none;
    cursor: pointer;
    transition: background-color .2s ease;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search button:hover,
:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search input[type="submit"]:hover {
    background: var(--ag-btn-gold-hover, linear-gradient(180deg, #ffe39a, #e9b73d));
    color: #081c35;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search input:focus-visible,
:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search button:focus-visible {
    outline: 3px solid #b1841a;
    outline-offset: 3px;
}

/* 8. Keep the search controls aligned on narrow screens. */
@media (max-width: 700px) {
    :is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search form {
        gap: 8px;
    }

    :is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search button,
    :is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search input[type="submit"] {
        min-width: 78px;
        padding-inline: 12px;
        font-size: 13px;
    }
}


/* 9. Override legacy button rules only within the catalog search form. */
:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search form button.agape-products__search-submit {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    position: static !important;
    width: auto !important;
    min-width: 98px;
    height: 46px !important;
    padding: 10px 20px !important;
    border: 1px solid #d9ae36 !important;
    border-radius: 7px !important;
    background: var(--ag-btn-gold, linear-gradient(180deg, #f6d878, #dfa92c)) !important;
    color: #071a2e !important;
    -webkit-text-fill-color: #071a2e !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    text-indent: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible;
    transform: none !important;
    cursor: pointer;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search-submit .agape-products__search-label {
    display: inline !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    clip: auto !important;
    clip-path: none !important;
    color: #071a2e !important;
    -webkit-text-fill-color: #071a2e !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    text-indent: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search-submit::before,
:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search-submit::after {
    content: none !important;
}

:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search form button.agape-products__search-submit:hover {
    background: var(--ag-btn-gold-hover, linear-gradient(180deg, #ffe39a, #e9b73d)) !important;
}
/* 10. Align the banner search with the page title. */
:is(#agape-inner, .agape-product-banner) .agape-page-banner .agape-products__search {
    width: 100%;
    max-width: 620px;
    margin: 16px 0 10px;
}

/* 11. Collapse spacing left by the retired Kadence search block. */
.wp-block-spacer:has(+ .agape-retired-search),
.agape-retired-search + p:empty {
    display: none;
}

/* 12. Handle the legacy search when a plugin outputs the block as raw HTML. */
.agape-has-banner-search .kadence-column3429_8f3375-3c:has(.aws-container),
.agape-has-banner-search .wp-block-spacer:has(+ .kadence-column3429_8f3375-3c .aws-container),
.agape-has-banner-search .kadence-column3429_8f3375-3c:has(.aws-container) + p:empty {
    display: none;
}
