/*
 * Topbar scroll stability — completion layer (loads last)
 * Bar shell + chip backgrounds only; icon geometry matches step94 everywhere.
 */

:root {
    --fp-topbar-chip-idle-bg: rgba(255, 255, 255, 0.048);
    --fp-topbar-chip-idle-border: rgba(255, 255, 255, 0.1);
    --fp-topbar-chip-scroll-bg: rgba(255, 255, 255, 0.068);
    --fp-topbar-chip-scroll-border: rgba(255, 255, 255, 0.13);
    --fp-topbar-chip-blur: blur(10px) saturate(1.06);
}

.topbar-glass {
    transition:
        background 0.26s ease,
        border-color 0.26s ease,
        box-shadow 0.26s ease,
        backdrop-filter 0.26s ease,
        -webkit-backdrop-filter 0.26s ease !important;
}

.topbar-glass:not(.is-scrolled) {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Home hero idle: subtler icon chips so banners stay visible */
html body .filmparty-home > .topbar-glass:not(.is-scrolled) {
    --fp-topbar-chip-idle-bg: rgba(255, 255, 255, 0.016);
    --fp-topbar-chip-idle-border: rgba(255, 255, 255, 0.042);
    --fp-topbar-chip-blur: blur(3px) saturate(1.02);
}

.topbar-glass.is-scrolled {
    background: var(--glass-topbar-scrolled, rgba(11, 13, 17, 0.68)) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.32) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
}

/* Square icon controls — same box in idle/scrolled */
html body .topbar-glass .topbar-left .search-open-btn,
html body .topbar-glass .topbar-left button.search-open-btn,
html body .topbar-glass .topbar-left a.search-open-btn,
html body .topbar-glass .topbar-left .catalog-top-link,
html body .topbar-glass .topbar-left .fp-topbar-wallet-stable,
html body .topbar-glass .notification-bell-shell.inside-topbar .notification-bell-btn,
html body .topbar-glass .notification-bell-shell[data-fp-step1208b-bell] .notification-bell-btn,
html body .topbar-glass .topbar-right .desktop-menu-btn {
    box-sizing: border-box !important;
    position: relative !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 var(--fp-topbar-control-size, 42px) !important;
    flex-basis: var(--fp-topbar-control-size, 42px) !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    width: var(--fp-topbar-control-size, 42px) !important;
    min-width: var(--fp-topbar-control-size, 42px) !important;
    max-width: var(--fp-topbar-control-size, 42px) !important;
    height: var(--fp-topbar-control-size, 42px) !important;
    min-height: var(--fp-topbar-control-size, 42px) !important;
    max-height: var(--fp-topbar-control-size, 42px) !important;
    border-radius: var(--fp-topbar-control-radius, 16px) !important;
    overflow: hidden !important;
    opacity: 1 !important;
    transform: none !important;
    scale: 1 !important;
    zoom: 1 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    transition:
        background 0.26s ease,
        border-color 0.26s ease,
        box-shadow 0.26s ease,
        backdrop-filter 0.26s ease,
        -webkit-backdrop-filter 0.26s ease !important;
}

html body .topbar-glass .topbar-left .search-open-btn,
html body .topbar-glass .topbar-left button.search-open-btn,
html body .topbar-glass .topbar-left a.search-open-btn {
    font-size: 0 !important;
    color: rgba(255, 255, 255, 0.92) !important;
}

html body .topbar-glass .topbar-left .catalog-top-link {
    font-size: 0 !important;
    color: rgba(255, 255, 255, 0.92) !important;
    text-decoration: none !important;
}

html body .topbar-glass .topbar-left .search-open-btn > *,
html body .topbar-glass .search-open-btn > * {
    display: none !important;
}

html body .topbar-glass:not(.is-scrolled) .topbar-left .search-open-btn,
html body .topbar-glass:not(.is-scrolled) .topbar-left button.search-open-btn,
html body .topbar-glass:not(.is-scrolled) .topbar-left a.search-open-btn,
html body .topbar-glass:not(.is-scrolled) .topbar-left .catalog-top-link,
html body .topbar-glass:not(.is-scrolled) .topbar-left .fp-topbar-wallet-stable,
html body .topbar-glass:not(.is-scrolled) .notification-bell-shell.inside-topbar .notification-bell-btn,
html body .topbar-glass:not(.is-scrolled) .notification-bell-shell[data-fp-step1208b-bell] .notification-bell-btn,
html body .topbar-glass:not(.is-scrolled) .topbar-right .desktop-menu-btn {
    background: var(--fp-topbar-chip-idle-bg) !important;
    border: 1px solid var(--fp-topbar-chip-idle-border) !important;
    backdrop-filter: var(--fp-topbar-chip-blur) !important;
    -webkit-backdrop-filter: var(--fp-topbar-chip-blur) !important;
    box-shadow: none !important;
}

html body .topbar-glass.is-scrolled .topbar-left .search-open-btn,
html body .topbar-glass.is-scrolled .topbar-left button.search-open-btn,
html body .topbar-glass.is-scrolled .topbar-left a.search-open-btn,
html body .topbar-glass.is-scrolled .topbar-left .catalog-top-link,
html body .topbar-glass.is-scrolled .topbar-left .fp-topbar-wallet-stable,
html body .topbar-glass.is-scrolled .notification-bell-shell.inside-topbar .notification-bell-btn,
html body .topbar-glass.is-scrolled .notification-bell-shell[data-fp-step1208b-bell] .notification-bell-btn,
html body .topbar-glass.is-scrolled .topbar-right .desktop-menu-btn {
    background: var(--fp-topbar-chip-scroll-bg) !important;
    border: 1px solid var(--fp-topbar-chip-scroll-border) !important;
    backdrop-filter: var(--fp-topbar-chip-blur) !important;
    -webkit-backdrop-filter: var(--fp-topbar-chip-blur) !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12) !important;
}

html body .topbar-glass .notification-bell-shell.inside-topbar,
html body .topbar-glass .notification-bell-shell[data-fp-step1208b-bell] {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    width: var(--fp-topbar-control-size, 42px) !important;
    height: var(--fp-topbar-control-size, 42px) !important;
    min-width: var(--fp-topbar-control-size, 42px) !important;
    min-height: var(--fp-topbar-control-size, 42px) !important;
}

/* Search magnifier — step94 centered geometry, all pages */
html body .topbar-glass .topbar-left .search-open-btn::before,
html body .topbar-glass .search-open-btn::before,
html body .topbar-glass .topbar-left button.search-open-btn::before {
    content: "" !important;
    position: absolute !important;
    display: block !important;
    width: 17px !important;
    height: 17px !important;
    left: 50% !important;
    top: 50% !important;
    margin-left: -9px !important;
    margin-top: -10px !important;
    border: 2px solid currentColor !important;
    border-radius: 999px !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

html body .topbar-glass .topbar-left .search-open-btn::after,
html body .topbar-glass .search-open-btn::after,
html body .topbar-glass .topbar-left button.search-open-btn::after {
    content: "" !important;
    position: absolute !important;
    display: block !important;
    width: 9px !important;
    height: 2px !important;
    left: 50% !important;
    top: 50% !important;
    margin-left: 5px !important;
    margin-top: 6px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: currentColor !important;
    transform: rotate(45deg) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Home icon — step94 centered geometry, all pages */
html body .topbar-glass .topbar-left .catalog-top-link::before {
    content: "" !important;
    position: absolute !important;
    display: block !important;
    width: 17px !important;
    height: 13px !important;
    left: 50% !important;
    top: 50% !important;
    margin-left: -8.5px !important;
    margin-top: -3px !important;
    border: 2px solid currentColor !important;
    border-top: 0 !important;
    border-radius: 3px 3px 5px 5px !important;
    box-sizing: border-box !important;
    background: transparent !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

html body .topbar-glass .topbar-left .catalog-top-link::after {
    content: "" !important;
    position: absolute !important;
    display: block !important;
    width: 12px !important;
    height: 12px !important;
    left: 50% !important;
    top: 50% !important;
    margin-left: -6px !important;
    margin-top: -10px !important;
    border-left: 2px solid currentColor !important;
    border-top: 2px solid currentColor !important;
    border-radius: 2px !important;
    box-sizing: border-box !important;
    background: transparent !important;
    transform: rotate(45deg) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Mobile target pages — keep 46px boxes + slightly larger icons (match home) */
@media (max-width: 640px) {
    html body .filmparty-home > .topbar-glass,
    html body .catalog-page > .topbar-glass,
    html body .fp-mobile-topbar-profile-scope > .topbar-glass,
    html body .search-results-page > .topbar-glass,
    html body .actor-profile-page > .topbar-glass,
    html body .director-profile-page > .topbar-glass,
    html body .movie-floating-page > .topbar-glass,
    html body .fp-stream-page > .topbar-glass,
    html body .profile-modern-page > .topbar-glass {
        --fp-topbar-control-size: 46px !important;
        --fp-topbar-control-radius: 17px !important;
    }

    html body .filmparty-home > .topbar-glass .topbar-left .search-open-btn::before,
    html body .catalog-page > .topbar-glass .topbar-left .search-open-btn::before,
    html body .fp-mobile-topbar-profile-scope > .topbar-glass .topbar-left .search-open-btn::before,
    html body .search-results-page > .topbar-glass .topbar-left .search-open-btn::before,
    html body .actor-profile-page > .topbar-glass .topbar-left .search-open-btn::before,
    html body .director-profile-page > .topbar-glass .topbar-left .search-open-btn::before,
    html body .movie-floating-page > .topbar-glass .topbar-left .search-open-btn::before,
    html body .fp-stream-page > .topbar-glass .topbar-left .search-open-btn::before,
    html body .profile-modern-page > .topbar-glass .topbar-left .search-open-btn::before {
        width: 19px !important;
        height: 19px !important;
        margin-left: -10px !important;
        margin-top: -11px !important;
    }

    html body .filmparty-home > .topbar-glass .topbar-left .search-open-btn::after,
    html body .catalog-page > .topbar-glass .topbar-left .search-open-btn::after,
    html body .fp-mobile-topbar-profile-scope > .topbar-glass .topbar-left .search-open-btn::after,
    html body .search-results-page > .topbar-glass .topbar-left .search-open-btn::after,
    html body .actor-profile-page > .topbar-glass .topbar-left .search-open-btn::after,
    html body .director-profile-page > .topbar-glass .topbar-left .search-open-btn::after,
    html body .movie-floating-page > .topbar-glass .topbar-left .search-open-btn::after,
    html body .fp-stream-page > .topbar-glass .topbar-left .search-open-btn::after,
    html body .profile-modern-page > .topbar-glass .topbar-left .search-open-btn::after {
        width: 10px !important;
        height: 2px !important;
        margin-left: 6px !important;
        margin-top: 7px !important;
    }

    html body .filmparty-home > .topbar-glass .topbar-left .catalog-top-link::before,
    html body .catalog-page > .topbar-glass .topbar-left .catalog-top-link::before,
    html body .fp-mobile-topbar-profile-scope > .topbar-glass .topbar-left .catalog-top-link::before,
    html body .search-results-page > .topbar-glass .topbar-left .catalog-top-link::before,
    html body .actor-profile-page > .topbar-glass .topbar-left .catalog-top-link::before,
    html body .director-profile-page > .topbar-glass .topbar-left .catalog-top-link::before,
    html body .movie-floating-page > .topbar-glass .topbar-left .catalog-top-link::before,
    html body .fp-stream-page > .topbar-glass .topbar-left .catalog-top-link::before,
    html body .profile-modern-page > .topbar-glass .topbar-left .catalog-top-link::before {
        width: 19px !important;
        height: 15px !important;
        margin-left: -9.5px !important;
        margin-top: -3px !important;
    }

    html body .filmparty-home > .topbar-glass .topbar-left .catalog-top-link::after,
    html body .catalog-page > .topbar-glass .topbar-left .catalog-top-link::after,
    html body .fp-mobile-topbar-profile-scope > .topbar-glass .topbar-left .catalog-top-link::after,
    html body .search-results-page > .topbar-glass .topbar-left .catalog-top-link::after,
    html body .actor-profile-page > .topbar-glass .topbar-left .catalog-top-link::after,
    html body .director-profile-page > .topbar-glass .topbar-left .catalog-top-link::after,
    html body .movie-floating-page > .topbar-glass .topbar-left .catalog-top-link::after,
    html body .fp-stream-page > .topbar-glass .topbar-left .catalog-top-link::after,
    html body .profile-modern-page > .topbar-glass .topbar-left .catalog-top-link::after {
        width: 14px !important;
        height: 14px !important;
        margin-left: -7px !important;
        margin-top: -11px !important;
    }

    /* Beat step94 mobile overflow:visible on control boxes — clip pseudo icons */
    html body .filmparty-home > .topbar-glass .topbar-left .search-open-btn,
    html body .filmparty-home > .topbar-glass.is-scrolled .topbar-left .search-open-btn,
    html body .filmparty-home > .topbar-glass .topbar-left .catalog-top-link,
    html body .catalog-page > .topbar-glass .topbar-left .search-open-btn,
    html body .catalog-page > .topbar-glass.is-scrolled .topbar-left .search-open-btn,
    html body .catalog-page > .topbar-glass .topbar-left .catalog-top-link,
    html body .fp-mobile-topbar-profile-scope > .topbar-glass .topbar-left .search-open-btn,
    html body .fp-mobile-topbar-profile-scope > .topbar-glass.is-scrolled .topbar-left .search-open-btn,
    html body .fp-mobile-topbar-profile-scope > .topbar-glass .topbar-left .catalog-top-link,
    html body .search-results-page > .topbar-glass .topbar-left .search-open-btn,
    html body .search-results-page > .topbar-glass .topbar-left .catalog-top-link,
    html body .actor-profile-page > .topbar-glass .topbar-left .search-open-btn,
    html body .actor-profile-page > .topbar-glass .topbar-left .catalog-top-link,
    html body .director-profile-page > .topbar-glass .topbar-left .search-open-btn,
    html body .director-profile-page > .topbar-glass .topbar-left .catalog-top-link,
    html body .movie-floating-page > .topbar-glass .topbar-left .search-open-btn,
    html body .movie-floating-page > .topbar-glass .topbar-left .catalog-top-link,
    html body .profile-modern-page > .topbar-glass .topbar-left .search-open-btn,
    html body .profile-modern-page > .topbar-glass .topbar-left .catalog-top-link,
    html body .fp-stream-page > .topbar-glass .topbar-left .search-open-btn {
        overflow: hidden !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .topbar-glass,
    html body .topbar-glass .topbar-left .search-open-btn,
    html body .topbar-glass .topbar-left .catalog-top-link,
    html body .topbar-glass .topbar-left .fp-topbar-wallet-stable,
    html body .topbar-glass .notification-bell-shell .notification-bell-btn,
    html body .topbar-glass .topbar-right .desktop-menu-btn {
        transition: none !important;
    }
}
