/* Only standalone forms need relative positioning for the dropdown. */
.adv-form-standalone {
    position: relative;
}

.adv-form-standalone .adv-search-leading-icon,
.adv-form-standalone .adv-button-icon,
.adv-form-standalone .adv-clear-button-icon {
    display: none;
    line-height: 0;
}

.adv-form-standalone .adv-clear-button {
    display: none;
}

/* Standalone inline results should behave like a dropdown below the search bar. */
.adv-form-standalone .adv-inline-results {
    position: absolute;
    top: calc(100% + var(--adv-results-offset-y, 8px));
    left: 0;
    width: var(--adv-results-width, 420px);
    max-width: var(--adv-results-max-width, 90vw);
    margin-top: 0;
    z-index: 9999;
    display: block;
    background: transparent;
}

/* Hide the inline container completely when empty. */
.adv-form-standalone .adv-inline-results:empty {
    display: none;
}

/* Style the standalone results list more like a compact dropdown panel. */
.adv-results-list-standalone {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px 14px;
    background:
        linear-gradient(180deg, rgba(12, 12, 12, 0.96) 0%, rgba(7, 7, 7, 0.96) 100%),
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 38%);
    border: 0;
    border-radius: 0;
    box-shadow: 0 22px 42px rgba(0, 0, 0, 0.34);
    overflow: hidden;
}

/* Make standalone result cards shorter and flatter. */
.adv-result-standalone {
    padding: 0;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    background: transparent;
}

.adv-form-standalone .adv-result-link {
    display: block;
    padding: 14px 10px;
    text-decoration: none;
    transition: background-color 0.18s ease;
}

.adv-form-standalone .adv-result-link:visited,
.adv-form-standalone .adv-result-link:hover,
.adv-form-standalone .adv-result-link:active {
    text-decoration: none;
}

.adv-form-standalone .adv-result-link,
.adv-form-standalone .adv-result-link:visited,
.adv-form-standalone .adv-result-link:hover,
.adv-form-standalone .adv-result-link:active,
.adv-form-standalone .adv-result-link:focus-visible {
    text-decoration: none !important;
}

.adv-result-standalone:hover .adv-result-link,
.adv-result-link:focus-visible {
    background: rgba(255, 255, 255, 0.04);
    outline: none;
}

/* Remove the bottom border from the last item. */
.adv-result-standalone:last-child {
    border-bottom: 0;
}

/* Put title and content type on one row. */
.adv-result-heading-row {
    display: block;
    margin-bottom: 6px;
}

/* Slightly reduce title size in standalone mode. */
.adv-form-standalone .adv-result-title {
    margin: 0;
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #f8f6f1;
    flex: 1 1 auto;
    min-width: 0;
}

/* Keep the type inline and compact. */
.adv-form-standalone .adv-result-meta-inline {
    display: none;
}

/* Tighten the excerpt text in standalone mode. */
.adv-form-standalone .adv-result-excerpt {
    font-family: "Instrument Sans", "Segoe UI", Arial, sans-serif;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.35;
}

.adv-form-standalone .adv-result-link .adv-result-excerpt {
    color: rgba(255, 255, 255, 0.5) !important;
}

.adv-form-standalone .adv-result-excerpt .adv-highlight {
    background: transparent;
    color: #e9e3d5;
    padding: 0 1px;
    border: 1px solid rgba(206, 152, 36, 0.88);
    border-radius: 0;
}

/* Style the empty and error states to match the dropdown. */
.adv-form-standalone .adv-empty,
.adv-form-standalone .adv-error {
    background: rgba(10, 10, 10, 0.96);
    color: #f8f6f1;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    box-shadow: 0 22px 42px rgba(0, 0, 0, 0.34);
    padding: 12px;
}

/* Reduce the status message spacing in standalone mode. */
.adv-form-standalone .adv-status {
    margin-top: 6px;
    font-family: "Instrument Sans", "Segoe UI", Arial, sans-serif;
    font-size: 12px;
}

/* Header mode keeps the standalone search compact until it is focused. */
.adv-header-search {
    width: min(100%, 360px);
    font-family: "Instrument Sans", "Segoe UI", Arial, sans-serif;
}

.adv-header-search .adv-form-standalone {
    --adv-header-collapsed-width: 142px;
    --adv-header-expanded-width: 360px;
    --adv-header-bg: #1a1a1a;
    --adv-header-border: #2b2b2b;
    --adv-header-border-focus: #b31515;
    --adv-header-text: #fbf8f4;
}

.adv-header-search .adv-search-row {
    position: relative;
    gap: 0;
    align-items: stretch;
    width: min(100%, var(--adv-header-collapsed-width));
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    overflow: hidden;
    box-shadow: none;
    transition: width 0.22s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.adv-header-search .adv-form-standalone:focus-within .adv-search-row,
.adv-header-search .adv-form-standalone.is-header-active .adv-search-row {
    width: min(100%, var(--adv-header-expanded-width));
    background: var(--adv-header-bg);
    border-color: var(--adv-header-border-focus);
    box-shadow: 0 0 0 3px rgba(179, 21, 21, 0.2);
}

.adv-header-search .adv-search-leading-icon {
    position: absolute;
    top: 50%;
    left: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--adv-header-text);
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.18s ease;
}

.adv-header-search .adv-input {
    padding: 11px 14px 11px 48px;
    border: 0;
    border-radius: 0;
    font-family: "Instrument Sans", "Segoe UI", Arial, sans-serif;
    color: var(--adv-header-text);
    background: transparent;
    transition: padding 0.18s ease;
}

.adv-header-search .adv-input::placeholder {
    color: rgba(251, 248, 244, 0.68);
}

.adv-header-search .adv-input::-webkit-search-decoration,
.adv-header-search .adv-input::-webkit-search-cancel-button,
.adv-header-search .adv-input::-webkit-search-results-button,
.adv-header-search .adv-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.adv-header-search .adv-input::-ms-clear,
.adv-header-search .adv-input::-ms-reveal {
    display: none;
    width: 0;
    height: 0;
}

.adv-header-search .adv-input:focus {
    outline: none;
}

.adv-header-search .adv-button {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 999px;
    font-family: "Instrument Sans", "Segoe UI", Arial, sans-serif;
    background: transparent;
    color: var(--adv-header-text);
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.adv-header-search .adv-clear-button {
    position: absolute;
    top: 50%;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    font-family: "Instrument Sans", "Segoe UI", Arial, sans-serif;
    background: transparent;
    color: var(--adv-header-text);
    cursor: pointer;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, background-color 0.18s ease;
}

.adv-header-search .adv-button:hover,
.adv-header-search .adv-button:focus-visible {
    background: rgba(251, 248, 244, 0.08);
}

.adv-header-search .adv-clear-button:hover,
.adv-header-search .adv-clear-button:focus-visible {
    background: rgba(251, 248, 244, 0.08);
    outline: none;
}

.adv-header-search .adv-button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.adv-header-search .adv-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.adv-header-search .adv-clear-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.adv-header-search .adv-form-standalone:focus-within .adv-button,
.adv-header-search .adv-form-standalone.is-header-active .adv-button {
    opacity: 1;
    pointer-events: auto;
}

.adv-header-search .adv-form-standalone.has-value .adv-button {
    opacity: 0;
    pointer-events: none;
}

.adv-header-search .adv-form-standalone.has-value .adv-clear-button {
    opacity: 1;
    pointer-events: auto;
}

.adv-header-search .adv-form-standalone:focus-within .adv-search-leading-icon,
.adv-header-search .adv-form-standalone.is-header-active .adv-search-leading-icon {
    opacity: 0;
}

.adv-header-search .adv-form-standalone:focus-within .adv-input,
.adv-header-search .adv-form-standalone.is-header-active .adv-input {
    padding-right: 54px;
    padding-left: 14px;
}

.adv-header-search .adv-form-standalone .adv-status {
    color: rgba(251, 248, 244, 0.78);
}

.adv-header-search .adv-form-standalone .adv-inline-results {
    top: calc(100% + 10px);
}

/* Better mobile behavior for standalone dropdowns. */
@media (max-width: 768px) {
    .adv-form-standalone .adv-inline-results {
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
    }

    .adv-result-heading-row {
        flex-wrap: wrap;
    }

    .adv-header-search .adv-search-row,
    .adv-header-search .adv-form-standalone:focus-within .adv-search-row,
    .adv-header-search .adv-form-standalone.is-header-active .adv-search-row {
        width: 100%;
    }

    .adv-header-search .adv-search-row {
        flex-direction: row;
    }
}
