/* STORE APP Patch 439
   Fixes regressions introduced by the final dark CSS rebase:
   - Language selector/dropdown visible on page load with oversized flags.
   - Product listing image wells not rendering --mp-product-card-bg backgrounds.
   - Remaining white/light buttons and low-contrast button text in storefront cards/forms. */

body.site-masterpalm{
  --mp439-panel:#0b1015;
  --mp439-panel-2:#121922;
  --mp439-line:rgba(255,255,255,.18);
  --mp439-line-strong:rgba(255,255,255,.30);
  --mp439-text:#f7f9fc;
  --mp439-muted:#c7d0da;
  --mp439-red:#d71920;
  --mp439-red-2:#a80f16;
  --mp439-red-3:#ff5058;
}

/* 1) Language selector must be closed by default.
   Patch 438's broad dark/button rules exposed the full language menu on page load.
   Hide the panel by default and only show it when JS adds .is-open or aria-hidden=false. */
body.site-masterpalm .ses-translate-panel,
body.site-masterpalm [id="sesTranslatePanel"]{
  display:none!important;
  position:absolute!important;
  top:calc(100% + 8px)!important;
  right:0!important;
  left:auto!important;
  width:min(280px,calc(100vw - 24px))!important;
  max-height:min(70vh,520px)!important;
  overflow:auto!important;
  padding:8px!important;
  margin:0!important;
  background:linear-gradient(180deg,#121922,#080c10)!important;
  border:1px solid var(--mp439-line)!important;
  border-radius:14px!important;
  box-shadow:0 22px 60px rgba(0,0,0,.52)!important;
  z-index:2147482600!important;
}
body.site-masterpalm .ses-translate-panel.is-open,
body.site-masterpalm [id="sesTranslatePanel"].is-open,
body.site-masterpalm .ses-translate-panel[aria-hidden="false"],
body.site-masterpalm [id="sesTranslatePanel"][aria-hidden="false"]{
  display:block!important;
}
body.site-masterpalm .mpb2b-topbar-language,
body.site-masterpalm .ses-language-selector,
body.site-masterpalm [data-ses-translate-trigger]{
  position:relative!important;
}
body.site-masterpalm .ses-language-menu{
  display:flex!important;
  flex-direction:column!important;
  gap:4px!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  padding:0!important;
  margin:0!important;
}
body.site-masterpalm .ses-language-option{
  display:flex!important;
  align-items:center!important;
  gap:8px!important;
  min-height:34px!important;
  padding:7px 9px!important;
  color:var(--mp439-text)!important;
  background:transparent!important;
  border:1px solid transparent!important;
  border-radius:10px!important;
  font-size:13px!important;
  line-height:1.2!important;
  text-decoration:none!important;
}
body.site-masterpalm .ses-language-option:hover,
body.site-masterpalm .ses-language-option.is-active,
body.site-masterpalm .ses-language-option[aria-checked="true"]{
  color:#fff!important;
  background:linear-gradient(90deg,rgba(215,25,32,.30),rgba(255,255,255,.06))!important;
  border-color:rgba(215,25,32,.38)!important;
}
body.site-masterpalm .ses-language-flag-img,
body.site-masterpalm .ses-language-current-flag-img,
body.site-masterpalm .ses-language-option img,
body.site-masterpalm [data-ses-selected-language-flag-img]{
  display:inline-block!important;
  width:18px!important;
  height:18px!important;
  min-width:18px!important;
  max-width:18px!important;
  min-height:18px!important;
  max-height:18px!important;
  object-fit:cover!important;
  border-radius:999px!important;
  background:#fff!important;
  box-shadow:0 0 0 1px rgba(255,255,255,.25)!important;
}
body.site-masterpalm .mpb2b-lang-topbar .ses-language-flag-img,
body.site-masterpalm .ses-language-compact .ses-language-flag-img{
  width:16px!important;
  height:16px!important;
  min-width:16px!important;
  max-width:16px!important;
  min-height:16px!important;
  max-height:16px!important;
}

/* 2) Restore product/category image rendering. The HTML uses CSS variables such as
   --mp-product-card-bg:url(...); these wells must keep their background-image after the
   dark-theme neutralizers set background/background-color. */
body.site-masterpalm .mp-product-list-media,
body.site-masterpalm .mp-product-list-media.has-product-image,
body.site-masterpalm .mpb2b-product-media,
body.site-masterpalm .mpb2b-product-media.has-product-image,
body.site-masterpalm .mp-card-media,
body.site-masterpalm .mp-category-card .mp-card-media{
  display:block!important;
  background-color:#f4f7fa!important;
  background-image:var(--mp-product-card-bg,var(--mp-card-bg,none))!important;
  background-repeat:no-repeat!important;
  background-position:center center!important;
  background-size:contain!important;
  opacity:1!important;
  visibility:visible!important;
  overflow:hidden!important;
}
body.site-masterpalm .mp-product-list-media::before,
body.site-masterpalm .mp-product-list-media::after,
body.site-masterpalm .mpb2b-product-media::before,
body.site-masterpalm .mpb2b-product-media::after,
body.site-masterpalm .mp-card-media::before,
body.site-masterpalm .mp-card-media::after{
  pointer-events:none!important;
}
body.site-masterpalm .mp-product-list-media.has-product-image::before,
body.site-masterpalm .mpb2b-product-media.has-product-image::before,
body.site-masterpalm .mp-card-media[style*="--mp-card-bg"]::before{
  background:transparent!important;
}
body.site-masterpalm .mp-product-list-media.is-missing-image,
body.site-masterpalm .mp-card-media:not([style*="--mp-card-bg"]):not(.has-product-image){
  background-image:linear-gradient(135deg,rgba(215,25,32,.12),rgba(9,14,19,.10))!important;
}

/* 3) Button cleanup: remove Bootstrap/light leftovers on dark storefront surfaces.
   Keep semantic warning/payment panels readable, but do not leave white storefront action buttons. */
body.site-masterpalm a.btn:not(.btn-close),
body.site-masterpalm button.btn:not(.btn-close),
body.site-masterpalm .mp-product-list-actions>a,
body.site-masterpalm .mp-product-list-actions>button,
body.site-masterpalm .mp-product-list-actions form>button,
body.site-masterpalm .mp-cart-square-button,
body.site-masterpalm .mp-quote-square-button,
body.site-masterpalm .mp-rfq-square-button,
body.site-masterpalm .mp-inline-search button,
body.site-masterpalm .mp-cta-actions a,
body.site-masterpalm .mp-sidebar-quote a,
body.site-masterpalm .mpb2b-btn,
body.site-masterpalm .mpb2b-btn-outline,
body.site-masterpalm .btn-light,
body.site-masterpalm .btn-outline-light,
body.site-masterpalm .btn-outline-secondary,
body.site-masterpalm .btn-secondary,
body.site-masterpalm .btn-primary{
  color:#fff!important;
  background:linear-gradient(180deg,var(--mp439-red),var(--mp439-red-2))!important;
  border:1px solid rgba(255,255,255,.22)!important;
  box-shadow:0 10px 24px rgba(0,0,0,.35)!important;
  text-shadow:none!important;
}
body.site-masterpalm a.btn:hover,
body.site-masterpalm button.btn:hover,
body.site-masterpalm .mp-product-list-actions>a:hover,
body.site-masterpalm .mp-product-list-actions>button:hover,
body.site-masterpalm .mp-product-list-actions form>button:hover,
body.site-masterpalm .mp-cart-square-button:hover,
body.site-masterpalm .mp-quote-square-button:hover,
body.site-masterpalm .mp-rfq-square-button:hover,
body.site-masterpalm .mp-inline-search button:hover,
body.site-masterpalm .mp-cta-actions a:hover,
body.site-masterpalm .mp-sidebar-quote a:hover,
body.site-masterpalm .mpb2b-btn:hover{
  color:#fff!important;
  background:linear-gradient(180deg,var(--mp439-red-3),var(--mp439-red))!important;
  border-color:rgba(255,255,255,.34)!important;
  transform:translateY(-1px);
}
body.site-masterpalm .mp-product-list-actions>a:first-child,
body.site-masterpalm .mpb2b-btn-outline,
body.site-masterpalm .btn-outline-light,
body.site-masterpalm .btn-outline-secondary,
body.site-masterpalm .nl-actions .btn-link{
  color:#f3f6fa!important;
  background:linear-gradient(180deg,#202a33,#10161d)!important;
  border-color:rgba(255,255,255,.24)!important;
}
body.site-masterpalm .mp-rfq-square-button,
body.site-masterpalm .mp-quote-square-button{
  color:#ffd9dc!important;
  background:linear-gradient(180deg,#3a1115,#160a0d)!important;
  border-color:rgba(215,25,32,.55)!important;
}
body.site-masterpalm .mp-rfq-square-button i,
body.site-masterpalm .mp-quote-square-button i,
body.site-masterpalm .mp-cart-square-button i{
  color:inherit!important;
}

/* 4) Text contrast on dark blocks that still inherited white or pale utility styles. */
body.site-masterpalm .mp-product-list-body,
body.site-masterpalm .mp-product-list-body h3,
body.site-masterpalm .mp-product-list-body h3 a,
body.site-masterpalm .mp-product-list-body p,
body.site-masterpalm .mp-product-list-price,
body.site-masterpalm .mp-product-list-price strong,
body.site-masterpalm .mp-category-copy,
body.site-masterpalm .mp-category-copy h2,
body.site-masterpalm .mp-category-copy h3,
body.site-masterpalm .mp-category-copy p,
body.site-masterpalm .mp-category-copy li,
body.site-masterpalm .mp-product-results-head,
body.site-masterpalm .mp-product-results-head h2,
body.site-masterpalm .mp-product-results-head span,
body.site-masterpalm .mp-category-nav a,
body.site-masterpalm .mp-category-sidebar h2,
body.site-masterpalm .mp-sidebar-quote strong,
body.site-masterpalm .mp-sidebar-quote span{
  color:var(--mp439-text)!important;
}
body.site-masterpalm .mp-product-list-body p,
body.site-masterpalm .mp-category-copy p,
body.site-masterpalm .mp-category-copy li,
body.site-masterpalm .mp-product-results-head span,
body.site-masterpalm .mp-sidebar-quote span{
  color:var(--mp439-muted)!important;
}
body.site-masterpalm .mp-product-sku,
body.site-masterpalm .mp-product-list-price strong,
body.site-masterpalm .mp-product-list-price.is-quote strong{
  color:#fff!important;
}

/* 5) Newsletter popup still has inline white CSS in the template; override it after inline styles. */
body.site-masterpalm .nl-modal{
  background:linear-gradient(180deg,#151d25,#080d12)!important;
  color:var(--mp439-text)!important;
  border:1px solid var(--mp439-line)!important;
}
body.site-masterpalm .nl-title,
body.site-masterpalm .nl-desc,
body.site-masterpalm .nl-fine,
body.site-masterpalm .nl-badge,
body.site-masterpalm .nl-msg{
  color:var(--mp439-text)!important;
}
body.site-masterpalm .nl-desc,
body.site-masterpalm .nl-fine{color:var(--mp439-muted)!important;}
body.site-masterpalm .nl-close{
  background:#111820!important;
  color:#fff!important;
  border-color:var(--mp439-line)!important;
}

@media (max-width:991.98px){
  body.site-masterpalm .ses-translate-panel,
  body.site-masterpalm [id="sesTranslatePanel"]{
    position:fixed!important;
    top:64px!important;
    right:12px!important;
    left:12px!important;
    width:auto!important;
    max-width:none!important;
  }
}
