/* TPS: mini-cart dropdown */
/* Header mini-cart (giỏ xổ xuống) — user palette dark gray-black + brand greens */

.header .cart-item.has-dropdown > .nav-dropdown,
.header-main .cart-item.has-dropdown > .nav-dropdown,
.header-wrapper .cart-item.has-dropdown > .nav-dropdown {
  min-width: 340px !important;
  width: 340px !important;
  max-width: min(92vw, 380px) !important;
  padding: 14px 16px 16px !important;
  margin-top: 8px !important;
  background: rgba(22, 27, 29, 0.92) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.18) !important;
  overflow: hidden !important;
  color: #F5F7F6 !important;
  z-index: 10055 !important;
}

.header .cart-item.has-dropdown > .nav-dropdown:before,
.header-main .cart-item.has-dropdown > .nav-dropdown:before,
.header-wrapper .cart-item.has-dropdown > .nav-dropdown:before {
  border-bottom-color: rgba(22, 27, 29, 0.92) !important;
}

.header .cart-item.has-dropdown > .nav-dropdown:after,
.header-main .cart-item.has-dropdown > .nav-dropdown:after,
.header-wrapper .cart-item.has-dropdown > .nav-dropdown:after {
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

.header .cart-item .nav-dropdown > li.html.widget_shopping_cart,
.header .cart-item .nav-dropdown .widget_shopping_cart,
.header .cart-item .nav-dropdown .widget_shopping_cart_content {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #F5F7F6 !important;
}

/* Product list */
.header .cart-item .woocommerce-mini-cart.cart_list,
.header .cart-item ul.cart_list.product_list_widget {
  width: 100% !important;
  max-width: 100% !important;
  max-height: 320px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.header .cart-item .woocommerce-mini-cart.cart_list::-webkit-scrollbar {
  width: 6px;
}
.header .cart-item .woocommerce-mini-cart.cart_list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

/* Product rows */
.header .cart-item .woocommerce-mini-cart-item.mini_cart_item {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 64px !important;
  height: auto !important;
  margin: 0 !important;
  padding: 12px 28px 12px 76px !important;
  overflow: hidden !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: transparent !important;
  box-sizing: border-box !important;
  list-style: none !important;
}

.header .cart-item .woocommerce-mini-cart-item.mini_cart_item:last-child {
  border-bottom: 0 !important;
}

/* Thumb — keep light pad so product photos pop */
.header .cart-item .mini_cart_item img {
  position: absolute !important;
  top: 12px !important;
  left: 0 !important;
  right: auto !important;
  width: 60px !important;
  height: 60px !important;
  max-width: 60px !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: cover !important;
  border-radius: 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: #fafafa !important;
  box-shadow: none;
}

/* Product name — white / near-white */
.header .cart-item .mini_cart_item > a:not(.remove) {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2;
  overflow: hidden !important;
  max-width: 100% !important;
  margin: 0 0 4px !important;
  padding: 0 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  color: #FFFFFF !important;
  text-decoration: none !important;
  word-break: break-word !important;
}

.header .cart-item .mini_cart_item > a:not(.remove):hover {
  color: #00C875 !important;
}

/* Qty — secondary muted */
.header .cart-item .mini_cart_item .quantity {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  color: #9CA7A2 !important;
}

/* Product price — soft light (NOT brand green) */
.header .cart-item .mini_cart_item .quantity .amount,
.header .cart-item .mini_cart_item .quantity .woocommerce-Price-amount,
.header .cart-item .mini_cart_item .quantity bdi {
  color: #DDE5E1 !important;
  font-weight: 700 !important;
}

/* Remove (×) — soft circle */
.header .cart-item .mini_cart_item a.remove.remove_from_cart_button,
.header .cart-item .mini_cart_item a.remove {
  position: absolute !important;
  top: 12px !important;
  right: 0 !important;
  left: auto !important;
  z-index: 5 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #C9D1CD !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  text-align: center !important;
  text-decoration: none !important;
  box-shadow: none !important;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease !important;
}

.header .cart-item .mini_cart_item a.remove:hover,
.header .cart-item .mini_cart_item a.remove:focus {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #FFFFFF !important;
  transform: scale(1.05);
}

/* Subtotal */
.header .cart-item .woocommerce-mini-cart__total.total,
.header .cart-item p.total {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  width: 100% !important;
  margin: 10px 0 12px !important;
  padding: 12px 0 4px !important;
  border: 0 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: transparent !important;
  text-align: left !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #9CA7A2 !important;
  line-height: 1.4 !important;
}

.header .cart-item .woocommerce-mini-cart__total.total strong,
.header .cart-item p.total strong {
  font-weight: 600 !important;
  color: #F5F7F6 !important;
}

/* Tổng tiền — bright green + bold */
.header .cart-item .woocommerce-mini-cart__total.total .amount,
.header .cart-item .woocommerce-mini-cart__total.total .woocommerce-Price-amount,
.header .cart-item .woocommerce-mini-cart__total.total bdi,
.header .cart-item p.total .amount,
.header .cart-item p.total .woocommerce-Price-amount {
  color: #22E58C !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

/* CTAs */
.header .cart-item .woocommerce-mini-cart__buttons.buttons,
.header .cart-item p.buttons {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.header .cart-item .woocommerce-mini-cart__buttons .button,
.header .cart-item .woocommerce-mini-cart__buttons a.button,
.header .cart-item p.buttons .button,
.header .cart-item p.buttons a.button {
  flex: 1 1 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 40px !important;
  margin: 0 !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  border: 1.5px solid #00B96B !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  letter-spacing: 0.01em !important;
  text-align: center !important;
  text-decoration: none !important;
  text-transform: none !important;
  box-shadow: none !important;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease !important;
}

/* Xem giỏ hàng — outline brand green */
.header .cart-item .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout),
.header .cart-item p.buttons a.button.wc-forward:not(.checkout) {
  background: transparent !important;
  color: #32D993 !important;
  border-color: #00B96B !important;
}

.header .cart-item .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout):hover,
.header .cart-item p.buttons a.button.wc-forward:not(.checkout):hover {
  background: rgba(0, 185, 107, 0.12) !important;
  color: #00C875 !important;
  border-color: #00C875 !important;
}

/* Thanh toán — solid brand green */
.header .cart-item .woocommerce-mini-cart__buttons a.button.checkout,
.header .cart-item .woocommerce-mini-cart__buttons a.checkout.wc-forward,
.header .cart-item p.buttons a.button.checkout,
.header .cart-item p.buttons a.checkout.wc-forward {
  background: #00B96B !important;
  color: #fff !important;
  border-color: #00B96B !important;
}

.header .cart-item .woocommerce-mini-cart__buttons a.button.checkout:hover,
.header .cart-item .woocommerce-mini-cart__buttons a.checkout.wc-forward:hover,
.header .cart-item p.buttons a.button.checkout:hover {
  background: #00D17C !important;
  border-color: #00D17C !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(0, 185, 107, 0.35) !important;
}

/* Empty cart */
.header .cart-item .woocommerce-mini-cart__empty-message,
.header .cart-item .widget_shopping_cart_content > p.woocommerce-mini-cart__empty-message {
  margin: 8px 0 4px !important;
  padding: 28px 12px !important;
  text-align: center !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  color: #9CA7A2 !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px dashed rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
}

/* Refine tps-cart-pop open animation (AJAX ATC) */
.header .cart-item.has-dropdown.tps-cart-pop > .nav-dropdown {
  transition:
    opacity 0.28s ease,
    transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1),
    visibility 0.28s ease !important;
  transform: translateY(8px) scale(0.98);
  transform-origin: top right;
  will-change: opacity, transform;
}

.header .cart-item.has-dropdown.tps-cart-pop.current-dropdown > .nav-dropdown,
.header .cart-item.has-dropdown.tps-cart-pop.cart-active > .nav-dropdown,
.header .cart-item.has-dropdown.tps-cart-pop:hover > .nav-dropdown {
  opacity: 1 !important;
  transform: translateY(0) scale(1);
  visibility: visible;
  max-height: none;
}

@media (max-width: 420px) {
  .header .cart-item.has-dropdown > .nav-dropdown {
    min-width: min(92vw, 340px) !important;
    width: min(92vw, 340px) !important;
  }
  .header .cart-item .woocommerce-mini-cart__buttons.buttons,
  .header .cart-item p.buttons {
    flex-direction: column !important;
  }
}

/* Full-page scrim DISABLED — keep JS body.tps-mini-cart-open harmless; panel palette unchanged */
body.tps-mini-cart-open::before {
  content: none !important;
  display: none !important;
  background: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  pointer-events: none !important;
}

/* Sale KM lightbox vs mini-cart: keep dropdown above magnific (~1042) stacking */
body.mfp-ready .header .cart-item.has-dropdown,
body.mfp-ready .header-main .cart-item.has-dropdown,
body.mfp-ready .header-wrapper .cart-item.has-dropdown {
  z-index: 20050 !important;
  position: relative;
}
body.mfp-ready .header .cart-item.has-dropdown > .nav-dropdown,
body.mfp-ready .header-main .cart-item.has-dropdown > .nav-dropdown,
body.mfp-ready .header-wrapper .cart-item.has-dropdown > .nav-dropdown {
  z-index: 20055 !important;
}
html.tps-hide-sale-mfp .mfp-bg,
html.tps-hide-sale-mfp .mfp-wrap {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}


/* ==========================================================================
 * 1.0.35 — Restrict mini-cart hover target to Giỏ hàng icon/link
 *
 * Flatsome hoverIntent binds on li.cart-item.has-dropdown. The closed
 * .nav-dropdown stays opacity:0 / visibility:visible with pointer-events:auto,
 * so its ~340×362 box under the header (and under Account) still hit-tests and
 * opens the dropdown when hovering adjacent empty space.
 *
 * Fix (desktop ≥850px): pointer-events:none while closed; restore when open.
 * Extend open LI hit area down across the 8px margin gap so pointer can travel
 * icon → panel without firing hoverIntent out. Mobile click/off-canvas untouched.
 * ========================================================================== */
@media (min-width: 850px) {
  .header .cart-item.has-dropdown:not(.current-dropdown):not(.cart-active) > .nav-dropdown,
  .header-main .cart-item.has-dropdown:not(.current-dropdown):not(.cart-active) > .nav-dropdown,
  .header-wrapper .cart-item.has-dropdown:not(.current-dropdown):not(.cart-active) > .nav-dropdown {
    pointer-events: none !important;
  }

  .header .cart-item.has-dropdown.current-dropdown > .nav-dropdown,
  .header .cart-item.has-dropdown.cart-active > .nav-dropdown,
  .header-main .cart-item.has-dropdown.current-dropdown > .nav-dropdown,
  .header-main .cart-item.has-dropdown.cart-active > .nav-dropdown,
  .header-wrapper .cart-item.has-dropdown.current-dropdown > .nav-dropdown,
  .header-wrapper .cart-item.has-dropdown.cart-active > .nav-dropdown {
    pointer-events: auto !important;
  }

  /* Bridge icon → panel across margin-top:8px while open */
  .header-main li.cart-item.has-dropdown.current-dropdown,
  .header-main li.cart-item.has-dropdown.cart-active {
    padding-bottom: 14px !important;
    margin-bottom: -14px !important;
  }
}
