/* CHB frontend fixes — mixed content leftovers, mobile, product cards, popup vs chat */

html {
  overflow-x: clip;
}
body {
  overflow-x: hidden;
}

/* Hide shipping weight on catalog cards (e.g. "950 g" on liquid colloids). */
ul.products .product-unit,
ul.products .product-weight,
ul.products .product .weight,
.products .product-footer .product-weight,
.klb-product .product-weight,
.product-wrapper .product-weight,
.product-wrapper .product-unit,
.product-content .product-weight,
.product-type-variable .product-weight,
.woocommerce ul.products li.product .product-weight,
.woocommerce ul.products li.product .product-unit,
.product-unit {
  display: none !important;
}

/* Empty / broken social icons (Twitter href was blank). */
footer a[href=""],
footer a[href="#"],
.site-footer a[href=""],
.klb-social a[href=""],
.elementor-social-icon-twitter:not([href]),
.elementor-social-icon-twitter[href=""],
.elementor-social-icon-twitter[href="#"] {
  display: none !important;
}

/* Newsletter popup above LiveChat; chat sits below while popup is open. */
#chb-popup-root.is-open,
#chb-popup-root.is-open .chb-popup-backdrop,
#chb-popup-root.is-open .chb-popup-card {
  z-index: 2147483600 !important;
}
html.chb-popup-open #chat-widget-container,
html.chb-popup-open iframe[src*="livechat"],
html.chb-popup-open [id^="chat-widget"],
html.chb-mnav-open #chat-widget-container,
html.chb-mnav-open iframe[src*="livechat"],
html.chb-mnav-open iframe[title="LiveChat chat widget"],
html.chb-mnav-open #livechat-eye-catcher,
html.chb-mnav-open [id^="chat-widget"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

/* Hero slides off-canvas must not widen the page. */
#chb-temp-hero-root,
#chb-temp-hero-root .hero,
body.home .hero-slide {
  max-width: 100vw;
  overflow: hidden;
}

/* Mobile tap targets + readable type. */
@media (max-width: 767px) {
  .header-buttons a,
  .header-cart,
  .header-login,
  .header-search,
  button.menu-toggle,
  .mobile-nav-button,
  .elementor-menu-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  #chb-popup-root .chb-popup-card {
    max-width: calc(100vw - 24px);
    margin: 12px auto;
  }

  #chb-popup-root .chb-popup-media {
    display: none;
  }
}

/* Prevent iOS from zooming only on focus while still allowing pinch-zoom. */
input, select, textarea {
  font-size: 16px;
}

@media (max-width: 900px) {
  #chat-widget-container,
  iframe[title="LiveChat chat widget"] {
    bottom: 80px !important;
  }
}

/* Header logo — transparent, no square tile */
.elementor-location-header img,
.site-header .site-brand img,
.chb-popup-logo,
.elementor-location-header .elementor-widget-theme-site-logo img {
  background: transparent !important;
  mix-blend-mode: multiply !important;
  box-shadow: none !important;
}
.elementor-location-header .elementor-widget-theme-site-logo,
.elementor-location-header .elementor-widget-theme-site-logo .elementor-widget-container,
.elementor-location-header .elementor-widget-image .elementor-widget-container {
  background: transparent !important;
  box-shadow: none !important;
}

/* Desktop logo sits in the search row, not on the category bar */
@media (min-width: 1025px) {
  .elementor-location-header .elementor-widget-theme-site-logo,
  .elementor-location-header .elementor-widget-theme-site-logo .elementor-widget-container {
    padding: 4px 12px 18px 4px !important;
  }
  .elementor-location-header .elementor-widget-theme-site-logo img {
    height: 62px !important;
    max-height: 62px !important;
    max-width: 180px !important;
    width: auto !important;
    object-fit: contain !important;
    object-position: left center !important;
  }
}

/* Mobile header: hamburger | wordmark | search | account | cart. No overlap. CSS-only — JS is delayed by LiteSpeed. */
@media (max-width: 1024px) {
  .elementor-location-header .elementor-element-cf3056e > .e-con-inner {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    position: relative !important;
  }
  .elementor-location-header .elementor-element-64d4b92 {
    margin-left: auto !important;
    position: relative !important;
    z-index: 6 !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex: 0 0 44px !important;
  }
  .elementor-location-header .elementor-element-07c51f9,
  .elementor-location-header .elementor-widget-fibosearch {
    position: relative !important;
    z-index: 6 !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex: 0 0 44px !important;
    margin-left: 0 !important;
  }
  .elementor-location-header .elementor-element-75d1706 {
    --e-transform-translateX: 0px !important;
    --e-transform-translateY: 0px !important;
    position: absolute !important;
    left: 54px !important;
    right: 150px !important;
    top: 50% !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    transform: translateY(-50%) !important;
    overflow: visible !important;
    padding: 0 !important;
    z-index: 3 !important;
  }
  .elementor-location-header .elementor-element-75d1706.chb-logo-inflow {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    inset: auto !important;
    transform: none !important;
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: 168px !important;
    margin: 0 !important;
  }
  .elementor-location-header .elementor-element-75d1706::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 150px !important;
    max-width: 100% !important;
    height: 40px !important;
    background-image: url("https://crystalhealthandbeauty.co.uk/wp-content/uploads/chb-email/logo-email.png") !important;
    background-repeat: no-repeat !important;
    background-position: left center !important;
    background-size: contain !important;
    mix-blend-mode: multiply !important;
    pointer-events: none !important;
    z-index: 4 !important;
  }
  .elementor-location-header .elementor-element-75d1706 img {
    height: 38px !important;
    max-height: 40px !important;
    width: 150px !important;
    max-width: 100% !important;
    margin: 0 !important;
    opacity: 0 !important;
    object-fit: contain !important;
  }
}

/* Product pages: one gutter, full-width card — do not fight product-v5 display:contents */
@media (max-width: 767px) {
  html body.single-product .shop-content > .container,
  html body.single-product .container {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
  }
  html body.single-product .single-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  html body.single-product .product.type-product {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  html body.single-product .product-images,
  html body.single-product .product-detail,
  html body.single-product .col-12.product-images,
  html body.single-product .col-12.product-detail {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    float: none !important;
  }
  html body.single-product .woocommerce-product-gallery,
  html body.single-product .woocommerce-product-gallery__wrapper,
  html body.single-product .woocommerce-product-gallery__image img {
    width: 100% !important;
    max-width: 100% !important;
  }
  html body.single-product h1.product_title {
    font-size: 1.75rem !important;
    line-height: 1.15 !important;
  }
  html body.single-product .cart,
  html body.single-product .single_add_to_cart_button {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Breadcrumbs — stop shouting */
body.tax-product_cat .woocommerce-breadcrumb,
body.tax-product_cat .woocommerce-breadcrumb li,
body.tax-product_cat .woocommerce-breadcrumb a,
body.tax-product_cat .woocommerce-breadcrumb span,
body.archive .woocommerce-breadcrumb,
body.archive .woocommerce-breadcrumb li,
body.archive .woocommerce-breadcrumb a,
.woocommerce-breadcrumb,
.woocommerce-breadcrumb li,
.woocommerce-breadcrumb a,
.klb-breadcrumb,
.klb-breadcrumb a,
body.tax-product_cat .site-content .woocommerce-breadcrumb li {
  text-transform: none !important;
}

/* Product image lightbox above the category bar; cream arrow buttons. */
html body .pswp,
html body .pswp--open,
html body #photoswipe-fullscreen-dialog,
html body .elementor-lightbox,
html body .dialog-lightbox-widget {
  z-index: 200000 !important;
}
html body:has(.pswp--open) #chb-nav,
html body:has(.pswp--open) .elementor-location-header,
html body:has(.elementor-lightbox) #chb-nav {
  z-index: 1 !important;
}
html body .pswp__bg {
  background: #14100e !important;
}
html body .pswp__button--arrow--left,
html body .pswp__button--arrow--right {
  width: 52px !important;
  height: 52px !important;
  margin-top: -26px !important;
  background: #f7f2eb !important;
  background-image: none !important;
  border-radius: 50% !important;
  opacity: 1 !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
html body .pswp__button--arrow--left {
  left: 16px !important;
}
html body .pswp__button--arrow--right {
  right: 16px !important;
}
html body .pswp__button--arrow--left::before,
html body .pswp__button--arrow--right::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 12px !important;
  height: 12px !important;
  margin: 0 !important;
  background: none !important;
  background-image: none !important;
  background-color: transparent !important;
  box-sizing: border-box !important;
}
html body .pswp__button--arrow--left::before {
  border: solid #1a2744 !important;
  border-width: 0 0 3px 3px !important;
  transform: translate(-30%, -50%) rotate(45deg) !important;
}
html body .pswp__button--arrow--right::before {
  border: solid #1a2744 !important;
  border-width: 3px 3px 0 0 !important;
  transform: translate(-70%, -50%) rotate(45deg) !important;
}
html body .pswp__button--close,
html body .pswp__button--zoom,
html body .pswp__button--fs {
  opacity: 1 !important;
}
html body.single-product .flex-direction-nav a,
html body.single-product .woocommerce-product-gallery .flex-prev,
html body.single-product .woocommerce-product-gallery .flex-next,
html body.single-product .woocommerce-product-gallery .slick-nav {
  width: 40px !important;
  height: 40px !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 6 !important;
  background: #fffef8 !important;
  color: #1a2744 !important;
  border-radius: 50% !important;
  box-shadow: 0 6px 16px rgba(26, 39, 68, 0.16) !important;
}

/* Cart: stack line items as cards on tablet + phone. Bacola keeps a table and hides price/subtotal. */
@media screen and (max-width: 1024px) {
  html body.woocommerce-cart .shop-content > .container,
  html body.woocommerce-cart .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box !important;
  }
  html body.woocommerce-cart .cart-wrapper {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 1.15rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  html body.woocommerce-cart .woocommerce-cart-form,
  html body.woocommerce-cart .cart-collaterals,
  html body.woocommerce-cart .cart_totals {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
  html body.woocommerce-cart .cart-collaterals {
    padding: 0 !important;
  }

  html body.woocommerce-cart table.shop_table.cart,
  html body.woocommerce-cart table.shop_table.cart.woocommerce-cart-form__contents {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
  }
  html body.woocommerce-cart table.shop_table.cart thead {
    display: none !important;
  }
  html body.woocommerce-cart table.shop_table.cart tbody {
    display: block !important;
    width: 100% !important;
  }
  html body.woocommerce-cart table.shop_table.cart tbody tr.cart_item {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr) 36px;
    grid-template-areas:
      "thumb name remove"
      "thumb price price"
      "qty qty subtotal";
    gap: 0.35rem 0.8rem;
    align-items: center;
    width: 100% !important;
    margin: 0 0 0.85rem !important;
    padding: 0.9rem !important;
    background: #fff !important;
    border: 1px solid #eee6dc !important;
    border-radius: 16px !important;
    box-sizing: border-box !important;
    position: relative !important;
  }
  html body.woocommerce-cart table.shop_table.cart td,
  html body.woocommerce-cart table.shop_table.cart th {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    text-align: left !important;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-price,
  html body.woocommerce-cart table.shop_table.cart td.product-subtotal,
  html body.woocommerce-cart table.shop_table.cart td.product-remove,
  html body.woocommerce-cart table.shop_table.cart th.product-price,
  html body.woocommerce-cart table.shop_table.cart th.product-subtotal,
  html body.woocommerce-cart table.shop_table.cart th.product-remove {
    display: block !important;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-thumbnail {
    grid-area: thumb;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-name {
    grid-area: name;
    min-width: 0 !important;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-name a {
    display: block;
    font-weight: 650;
    color: #2f3d2a !important;
    line-height: 1.3;
    word-break: break-word;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-price {
    grid-area: price;
    font-size: 0.92rem;
    color: #5c574e;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-quantity {
    grid-area: qty;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-subtotal {
    grid-area: subtotal;
    font-weight: 700;
    text-align: right !important;
    color: #2f3d2a;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-remove {
    grid-area: remove;
    position: static !important;
    width: 36px !important;
    justify-self: end;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-remove a {
    position: static !important;
    left: auto !important;
    top: auto !important;
    margin: 0 !important;
    width: 32px !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: #f7f2eb !important;
    color: #2f3d2a !important;
    font-size: 1rem !important;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-thumbnail img {
    width: 72px !important;
    max-width: 72px !important;
    height: 72px !important;
    object-fit: cover;
    border-radius: 10px;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-quantity .quantity {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-subtotal::before {
    content: "Subtotal ";
    font-weight: 500;
    color: #6b6458;
    margin-right: 0.3rem;
  }

  html body.woocommerce-cart table.shop_table.cart tbody tr:not(.cart_item) {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.9rem !important;
    background: #fff !important;
    border: 1px solid #eee6dc !important;
    border-radius: 16px !important;
    box-sizing: border-box !important;
  }
  html body.woocommerce-cart table.shop_table.cart td.actions {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
  }
  html body.woocommerce-cart .actions-wrapper,
  html body.woocommerce-cart .coupon {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
  }
  html body.woocommerce-cart .coupon #coupon_code,
  html body.woocommerce-cart .coupon .button,
  html body.woocommerce-cart .coupon button,
  html body.woocommerce-cart button[name="update_cart"],
  html body.woocommerce-cart .actions-wrapper .button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  html body.woocommerce-cart .cart_totals table.shop_table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
  }
  html body.woocommerce-cart .cart_totals table.shop_table tbody {
    display: block !important;
    width: 100% !important;
  }
  html body.woocommerce-cart .cart_totals table.shop_table tr {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 0.4rem 1rem !important;
    width: 100% !important;
    padding: 0.75rem 0 !important;
    box-sizing: border-box !important;
  }
  html body.woocommerce-cart .cart_totals table.shop_table th,
  html body.woocommerce-cart .cart_totals table.shop_table td {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
  }
  html body.woocommerce-cart .cart_totals table.shop_table td {
    text-align: right !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    word-break: break-word;
  }
  html body.woocommerce-cart .cart_totals table.shop_table tr.woocommerce-shipping-totals {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  html body.woocommerce-cart .cart_totals table.shop_table tr.woocommerce-shipping-totals td {
    text-align: left !important;
    width: 100% !important;
  }
  html body.woocommerce-cart .wc-proceed-to-checkout,
  html body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

}

/* Already on the basket page — the floating side-cart button covers totals. */
html body.woocommerce-cart #cfw-side-cart-floating-button,
html body.woocommerce-cart .cfw-side-cart-floating-button-anchor {
  display: none !important;
}

@media screen and (max-width: 520px) {
  html body.woocommerce-cart table.shop_table.cart tbody tr.cart_item {
    grid-template-columns: 64px minmax(0, 1fr) 32px;
    grid-template-areas:
      "thumb name remove"
      "thumb price price"
      "qty qty qty"
      "subtotal subtotal subtotal";
  }
  html body.woocommerce-cart table.shop_table.cart td.product-thumbnail img {
    width: 64px !important;
    max-width: 64px !important;
    height: 64px !important;
  }
  html body.woocommerce-cart table.shop_table.cart td.product-subtotal {
    text-align: left !important;
    padding-top: 0.15rem !important;
  }
}