/* Header search icon + full-screen blur overlay */

.header-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 50%;
    transition: color 0.2s ease, background 0.2s ease;
}

.header-search-btn i {
    font-size: 1.05rem;
    pointer-events: none;
}

.header-search-btn:hover,
.header-search-btn:focus-visible {
    color: #fff;
    outline: none;
}

.header-search-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.nav-right .header-search-btn--bar {
    margin-right: -1.5rem;
}

.header-search-btn--mobile {
    display: none;
}

.header-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(6, 6, 8, 0.42);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.header-search-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.header-search-close {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    font-size: 1.15rem;
}

.header-search-close:hover,
.header-search-close:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    outline: none;
}

.header-search-panel {
    width: min(640px, 100%);
    position: relative;
}

.header-search-form {
    display: flex;
    gap: 12px;
    position: relative;
}

.header-search-form input[type="search"],
.header-search-form input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 14px 18px;
    border-radius: 8px;
    border: none;
    font-size: 1.15rem;
    background: #23232b;
    color: #fff;
    outline: none;
}

.header-search-form input[type="search"]:focus,
.header-search-form input[type="text"]:focus {
    box-shadow: 0 0 0 2px #444;
}

.header-search-form input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    height: 14px;
    width: 14px;
    background: #fff;
    clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);
    cursor: pointer;
}

.header-search-form button[type="submit"] {
    background: #23232b;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 22px;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-search-form .movies-search-icon {
    flex-shrink: 0;
    opacity: 0.9;
    stroke: currentColor;
}

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

.header-search-overlay .autocomplete-items {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #23232b;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 1;
    max-height: min(340px, 45vh);
    overflow-y: auto;
    display: none;
}

.header-search-overlay .autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid #222;
    transition: background 0.15s;
}

.header-search-overlay .autocomplete-item:last-child {
    border-bottom: none;
}

.header-search-overlay .autocomplete-item:hover,
.header-search-overlay .autocomplete-item:focus,
.header-search-overlay .autocomplete-item.is-active {
    background: #353545;
    outline: none;
}

.header-search-overlay .autocomplete-poster {
    width: 38px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    background: #18181f;
}

.header-search-overlay .autocomplete-title {
    font-weight: 500;
    color: #fff;
    font-size: 1em;
}

.header-search-overlay .autocomplete-year {
    color: #aaa;
    font-size: 0.95em;
    margin-left: auto;
}

body.header-search-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .header-search-btn--mobile {
        display: flex;
        position: absolute;
        right: 72px;
        top: 13px;
        z-index: 1001;
        background: #000;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
        color: #fff;
    }

    .header-search-btn--mobile i {
        font-size: 1.15rem;
    }

    .header-search-overlay {
        padding: 1.25rem 1rem;
    }

    .header-search-form {
        flex-direction: row;
        gap: 8px;
    }

    .header-search-form .search-btn-text {
        display: none;
    }

    .header-search-form button[type="submit"] {
        padding: 0 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-search-overlay {
        transition: none;
    }
}
