/* v183 — premium fixed close controls + background scroll lock */
html:has(.modal.open),
html:has(.drawer.open),
html:has(.search-modal.open),
html:has(.modal-overlay.open),
html:has(.mobile-nav.open),
html:has(.premium-menu.open),
html:has(.universal-filter.open),
body:has(.modal.open),
body:has(.drawer.open),
body:has(.search-modal.open),
body:has(.modal-overlay.open),
body:has(.mobile-nav.open),
body:has(.premium-menu.open),
body:has(.universal-filter.open){
  overflow:hidden!important;
  overscroll-behavior:none!important;
}

/* Every exit/close control gets the same premium dark-glass language. */
#productModal .product-modal > .close,
#customerChatModal .customer-chat-card > .close,
#questionSentModal .small-modal > .close,
#wishlistModal .modal-card > .close,
#wishlistModal .wishlist-new-exit,
#accountModal .small-modal > .close,
#compareModal .compare-modal-card > .close,
#compareModal .compare-new-exit,
#locationConsentModal .small-modal > .close,
#cartDrawer .drawer-head > .close,
#searchModal .search-new-exit,
#mobileNav .menu-close,
#mobileNav.premium-menu .menu-close,
#universalFilter .universal-filter-close,
#universalFilter .filter-close,
.modal .close,
.search-modal .close,
.drawer .close{
  background:rgba(12,16,23,.88)!important;
  color:#fff!important;
  border:1px solid rgba(255,255,255,.16)!important;
  box-shadow:0 14px 34px rgba(0,0,0,.26),0 1px 0 rgba(255,255,255,.08) inset!important;
  -webkit-backdrop-filter:blur(18px) saturate(125%)!important;
  backdrop-filter:blur(18px) saturate(125%)!important;
}

#productModal .product-modal > .close:hover,
#customerChatModal .customer-chat-card > .close:hover,
#questionSentModal .small-modal > .close:hover,
#wishlistModal .modal-card > .close:hover,
#wishlistModal .wishlist-new-exit:hover,
#accountModal .small-modal > .close:hover,
#compareModal .compare-modal-card > .close:hover,
#compareModal .compare-new-exit:hover,
#locationConsentModal .small-modal > .close:hover,
#cartDrawer .drawer-head > .close:hover,
#searchModal .search-new-exit:hover,
#mobileNav .menu-close:hover,
#universalFilter .universal-filter-close:hover,
.modal .close:hover,
.search-modal .close:hover,
.drawer .close:hover{
  background:rgba(24,29,38,.96)!important;
  color:#fff!important;
  border-color:rgba(255,255,255,.28)!important;
  box-shadow:0 18px 42px rgba(0,0,0,.32),0 1px 0 rgba(255,255,255,.10) inset!important;
}

/* Product detail: the content scrolls, not the shell, so the exit never moves. */
#productModal .product-modal{
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
  min-height:0!important;
}
#productModal #productDetail{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow:auto!important;
  overscroll-behavior:contain!important;
  scrollbar-width:thin;
  scrollbar-color:#9aa3b1 transparent;
  position:relative!important;
}

/* Wishlist: fixed header/footer; only saved-pair content scrolls. */
#wishlistModal .wishlist-new-shell{
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
  min-height:0!important;
}
#wishlistModal .wishlist-new-head{
  flex:0 0 auto!important;
  position:relative!important;
  z-index:12!important;
}
#wishlistModal .wishlist-new-info{
  flex:0 0 auto!important;
  z-index:11!important;
}
#wishlistModal #wishlistItems{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow:auto!important;
  overscroll-behavior:contain!important;
  scrollbar-width:thin;
  scrollbar-color:#9aa3b1 transparent;
  align-content:start!important;
}
#wishlistModal .wishlist-new-foot{
  flex:0 0 auto!important;
  z-index:11!important;
}

/* Compare: header stays put while the comparison stage scrolls. */
#compareModal .compare-new-shell,
#compareModal .compare-modal-card{
  display:flex!important;
  flex-direction:column!important;
  min-height:0!important;
  overflow:hidden!important;
}
#compareModal .compare-new-head{
  flex:0 0 auto!important;
  position:relative!important;
  z-index:12!important;
}
#compareModal #compareStage,
#compareModal .compare-new-stage{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow:auto!important;
  overscroll-behavior:contain!important;
}

/* Search: heading/close stays fixed; results scroll underneath it. */
#searchModal .search-new-shell{
  display:flex!important;
  flex-direction:column!important;
  min-height:0!important;
  overflow:hidden!important;
}
#searchModal .search-new-head,
#searchModal .search-new-foot{
  flex:0 0 auto!important;
  z-index:12!important;
}
#searchModal .search-new-content{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow:auto!important;
  overscroll-behavior:contain!important;
}

/* Chat: header/exit and composer stay fixed; message thread alone scrolls. */
#customerChatModal .customer-chat-card{
  display:flex!important;
  flex-direction:column!important;
  min-height:0!important;
  overflow:hidden!important;
}
#customerChatModal .chat-head,
#customerChatModal .chat-instagram-head{
  flex:0 0 auto!important;
  position:relative!important;
  z-index:12!important;
}
#customerChatModal .customer-chat-thread{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow:auto!important;
  overscroll-behavior:contain!important;
}
#customerChatModal .customer-chat-form{
  flex:0 0 auto!important;
  position:relative!important;
  z-index:12!important;
}

/* Account/location dialogs: content may scroll, but the exit stays sticky. */
#accountModal .account-premium-card,
#locationConsentModal .small-modal,
#questionSentModal .small-modal{
  position:relative!important;
  overflow:auto!important;
  overscroll-behavior:contain!important;
}
#accountModal .account-premium-card > .close,
#locationConsentModal .small-modal > .close,
#questionSentModal .small-modal > .close{
  position:sticky!important;
  top:10px!important;
  margin:0 0 -44px auto!important;
  flex:0 0 44px!important;
  z-index:30!important;
}

/* Menu + filter: their headings stay visible while their bodies scroll. */
#mobileNav.premium-menu{
  overscroll-behavior:contain!important;
}
#mobileNav.premium-menu .premium-menu-head{
  position:sticky!important;
  top:0!important;
  z-index:30!important;
  flex:0 0 auto!important;
}
#universalFilter .universal-filter-head{
  position:sticky!important;
  top:0!important;
  z-index:30!important;
}
#universalFilter .universal-filter-body{
  overscroll-behavior:contain!important;
}

@media(max-width:560px){
  #productModal #productDetail{scrollbar-width:auto!important;}
  #wishlistModal #wishlistItems{scrollbar-width:auto!important;}
  #compareModal #compareStage,
  #compareModal .compare-new-stage,
  #searchModal .search-new-content,
  #customerChatModal .customer-chat-thread{scrollbar-width:auto!important;}
}

@media(prefers-reduced-motion:reduce){
  #productModal .product-modal > .close,
  #customerChatModal .customer-chat-card > .close,
  #wishlistModal .wishlist-new-exit,
  #accountModal .small-modal > .close,
  #compareModal .compare-new-exit,
  #locationConsentModal .small-modal > .close,
  #cartDrawer .drawer-head > .close,
  #searchModal .search-new-exit,
  #mobileNav .menu-close,
  #universalFilter .universal-filter-close{transition:none!important;}
}

/* Generic dynamically-created dialogs and simple modals. */
.modal-overlay:not(#customerChatModal) [role="dialog"]{
  position:relative!important;
  overflow:auto!important;
  overscroll-behavior:contain!important;
}
.modal-overlay:not(#customerChatModal) [role="dialog"] > .close{
  position:sticky!important;
  top:10px!important;
  margin:0 0 -44px auto!important;
  flex:0 0 44px!important;
  z-index:30!important;
}
.modal:not(#productModal) .modal-card{
  position:relative!important;
}
.modal:not(#productModal) .modal-card > .close{
  position:sticky!important;
  top:10px!important;
  margin:0 0 -44px auto!important;
  flex:0 0 44px!important;
  z-index:30!important;
}
