.search-focus-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20000;
    visibility: hidden;
    background: rgba(6, 5, 22, 0.74);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1), visibility 180ms;
}

body.search-focus-active .search-focus-backdrop {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

#search-form.search-form--active {
    z-index: 20001;
}

.catalog-container,
.search-form-container {
    overflow: visible;
}

.search-combobox {
    position: relative;
    border-radius: 14px;
    transition: background-color 180ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.search-form--active .search-combobox {
    margin: -10px;
    padding: 10px;
    background: var(--surface-1);
    box-shadow: 0 22px 56px rgba(4, 3, 18, 0.52);
}

#search-form .input-container {
    position: relative;
    z-index: 2;
}

#search-form input[data-search-input] {
    padding-right: 84px;
    background-color: var(--surface-1);
    color: var(--text-primary);
    transition: border-color 180ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1),
                background-color 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

#search-form input[data-search-input]:focus-visible {
    outline: 3px solid rgba(126, 231, 135, 0.32);
    outline-offset: 3px;
    border-color: var(--site-green);
    box-shadow: 0 0 0 1px var(--site-green), 0 12px 30px rgba(4, 3, 18, 0.34);
}

#search-button:focus-visible {
    outline: 3px solid var(--text-primary);
    outline-offset: -5px;
}

#search-button {
    top: 0;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 3;
    max-height: min(420px, 58vh);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface-1);
    color: var(--text-primary);
    box-shadow: 0 22px 52px rgba(4, 3, 18, 0.46);
}

.search-suggestions[hidden] {
    display: none;
}

.search-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    gap: 18px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
}

.search-suggestion:hover,
.search-suggestion[aria-selected="true"] {
    background: var(--surface-2);
    color: var(--text-primary);
}

.search-suggestion:focus-visible {
    outline: 2px solid var(--site-green);
    outline-offset: -2px;
}

.search-suggestion__name {
    min-width: 0;
    overflow: hidden;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggestion__hint {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.25;
}

.search-suggestion--all {
    margin-top: 5px;
    border-top: 1px solid var(--border-soft);
    border-radius: 0 0 9px 9px;
    color: var(--site-green);
}

.search-suggestions__empty {
    padding: 13px 12px;
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.4;
}

.search-form-error {
    margin: 8px 0 0;
    padding: 9px 11px;
    border: 1px solid rgba(248, 113, 113, 0.58);
    border-radius: 9px;
    background: rgba(127, 29, 29, 0.22);
    color: #fecaca;
    font-size: 0.875rem;
    line-height: 1.35;
}

.search-form-error:empty {
    display: none;
}

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

html[data-theme="light"] .search-focus-backdrop {
    background: rgba(24, 34, 53, 0.58);
}

html[data-theme="light"] .search-form--active .search-combobox,
html[data-theme="light"] .search-suggestions {
    box-shadow: 0 22px 52px rgba(15, 23, 42, 0.24);
}

html[data-theme="light"] .search-form-error {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fda4af;
}

@media (max-width: 600px) {
    .search-form--active .search-combobox {
        margin: -8px;
        padding: 8px;
    }

    #search-form input[data-search-input] {
        padding-right: 64px;
    }

    .search-suggestions {
        max-height: min(360px, 52vh);
    }

    .search-suggestion {
        min-height: 48px;
        padding: 11px 10px;
    }

    .search-suggestion__hint {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .search-focus-backdrop,
    .search-combobox,
    #search-form input[data-search-input] {
        transition-duration: 0.01ms;
    }
}
