/* CSS zalo and smax - Minimal fix */
.zalo-chat-widget {
  bottom: 90px !important;
  /* Đẩy icon Zalo lên cao */
  right: 15px !important;
  /* Cách lề phải một khoảng nhỏ */
  left: auto !important;
  z-index: 9999 !important;
}
.zalo-chat-box {
  max-height: 500px !important;
  /* Tăng chiều cao tối đa */
  overflow: visible !important;
  /* Ngăn chặn bị cắt mất */
}

/* Sửa lỗi Zalo trên trang sản phẩm desktop */
[data-template="product"] .zalo-chat-widget {
  position: fixed !important;
  bottom: 90px !important;
  right: 15px !important;
  left: auto !important;
  display: block !important;
  transform: none !important; /* Không thu nhỏ nút Zalo - giữ kích thước như trang chủ */
  z-index: 9999 !important;
}

/* Đảm bảo các element con của Zalo trong trang sản phẩm desktop không bị thu nhỏ */
[data-template="product"] .zalo-chat-widget iframe,
[data-template="product"] .zalo-chat-widget > div,
[data-template="product"] .zalo-chat-widget * {
  transform: none !important;
  scale: none !important;
}

/* Sửa lỗi chat box Zalo trên trang sản phẩm desktop */
[data-template="product"] .zalo-chat-box {
  position: fixed !important;
  right: 15px !important;
  bottom: 150px !important;
  left: auto !important;
  z-index: 10000 !important;
  transform: none !important;
  max-height: 500px !important;
  overflow: visible !important;
}
/* Chỉ bọc riêng chữ "TÌM KIẾM" */
#searct-template .heading-page h1 {
  background: white;
  padding: 15px 30px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: inline-block;
  margin: 0;
}

#searct-template .heading-page {
  text-align: center;
  margin-bottom: 20px;
}

/* Bọc phần "Kết quả tìm kiếm cho..." */
#searct-template .group-top-search {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#searct-template .group-top-search {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

#searct-template .right-result-search {
  gap: 20px;
}


#footer {
  z-index: 1;
}

#smax-chat-widget {
  position: fixed !important;
  bottom: 20px !important;
  /* Để nút Smax nằm thấp hơn Zalo */
  right: 15px !important;
  /* Cách lề phải một khoảng nhỏ */
  z-index: 9998 !important;
  /* Đảm bảo nút Smax ở dưới */
}
@media (max-width: 768px) {
  #sm-chatbox-action {
    bottom: 40px !important;
    /* Đẩy nút lên cao hơn */
    right: 10px !important;
    /* Cách lề phải ngang với nút Zalo */
    z-index: 9999 !important;
    /* Giữ trên cùng */
    transform: scale(0.85) !important;
    /* Thu nhỏ nút Smax */
    transform-origin: bottom right !important;
    /* Scale từ góc dưới bên phải */
  }
  /* Thu nhỏ widget Smax */
  #smax-chat-widget {
    transform: scale(0.80) !important;
    transform-origin: bottom right !important;
    /* Scale từ góc dưới bên phải */
    right: 10px !important;
    /* Cách lề phải ngang với nút Zalo */
  }
}
@media (max-width: 768px) {
  .zalo-chat-widget {
    bottom: 110px !important;
    /* Vị trí mặc định */
    right: 10px !important;
    /* Cách lề phải một khoảng nhỏ */
    z-index: 9999 !important;
    /* Giữ trên cùng */
    transform: scale(0.90) !important;
    /* Thu nhỏ nút Zalo */
  }

  /* Sửa lỗi Zalo trên trang sản phẩm mobile */
  [data-template="product"] .zalo-chat-widget {
    position: fixed !important;
    bottom: 110px !important;
    right: 10px !important;
    left: auto !important;
    display: block !important;
    transform: scale(0.80) !important;
    /* Thu nhỏ nút Zalo trên mobile trang sản phẩm */
    transform-origin: bottom right !important;
    z-index: 9999 !important;
  }

  /* Sửa lỗi chat box Zalo trên mobile trang sản phẩm */
  [data-template="product"] .zalo-chat-box {
    position: fixed !important;
    right: 10px !important;
    bottom: 170px !important;
    left: auto !important;
    max-width: 300px !important;
    max-height: 400px !important;
    transform: none !important;
    z-index: 10000 !important;
    overflow: visible !important;
  }

  /* Thu nhỏ icon Zalo - chỉ áp dụng cho trang khác, không áp dụng cho trang sản phẩm */
  .zalo-chat-widget:not([data-template="product"]) iframe,
  .zalo-chat-widget:not([data-template="product"]) > div {
    transform: scale(0.85) !important;
    transform-origin: bottom right !important;
  }

  /* Reset transform cho Zalo trong trang sản phẩm */
  [data-template="product"] .zalo-chat-widget iframe,
  [data-template="product"] .zalo-chat-widget > div {
    transform: none !important;
  }
}

/* Thêm style cho hình ảnh Christmas Tree */
.christmas-tree-widget {
  position: fixed !important;
  width: 290px;
  height: auto;
  bottom: -20px !important;
  /* Đặt từ lề dưới cùng đi lên */
  right: -75px !important;
  pointer-events: none;
  /* Chặn click */
  z-index: 998 !important;
  /* Ở sau (z-index thấp hơn) so với Zalo và Smax */
}
@media (max-width: 768px) {
  .christmas-tree-widget {
    width: 180px;
    height: auto;
    bottom: 30px !important;
    /* Điều chỉnh cho mobile, từ dưới cùng */
    right: -85px !important;
  }
}
/* Ảnh tuyết phủ lên nút Zalo */
.snow-on-zalo {
  position: fixed !important;
  bottom: 105px !important;
  /* cùng vị trí với Zalo */
  right: 20px !important;
  /* Điều chỉnh theo vị trí nút Zalo */
  width: 50px;
  /* vừa với kích thước nút Zalo */
  height: 50px;
  z-index: 10000 !important;
  /* nằm trên Zalo */
  transform: rotate(-180deg);
  opacity: 1.1;
  pointer-events: none;
  /* không cản thao tác click */
}

.snow-on-zalo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Căn chỉnh cho mobile */
@media (max-width: 768px) {
  .snow-on-zalo {
    bottom: 125px !important;
    /* khớp với vị trí nút Zalo mobile */
    right: 15px !important;
    /* Điều chỉnh theo vị trí nút Zalo */
    width: 42px;
    /* Thu nhỏ theo tỷ lệ 0.85 */
    height: 42px;
    transform: rotate(-180deg) scale(0.85) !important;
  }
}

/* PUstudio: Popup + Vintage Corner Styles */
/* Corner widget */.vintage-corner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  text-align: center;
  z-index: 99998;
}
/* Ẩn text đếm ngược mặc định, chỉ hiển thị trên trang chủ */
.vintage-corner {
  display: none !important;
}
/* Chỉ hiển thị text đếm ngược trên trang chủ */
body.template-index .vintage-corner {
  display: inline-block !important;
}
.record {
  width: 100px;
  height: 100px;
  background: radial-gradient(#000 20%, #222 60%, #000);
  border-radius: 50%;
  position: relative;
  animation: spin 8s linear infinite;
  border: 8px solid #8b4513;
  box-shadow: 0 0 30px #ff4500;
  cursor: pointer;
}
.record::before {
  content: '';
  position: absolute;
  inset: 20px;
  background: #c41f3a;
  border-radius: 50%;
}
.record::after {
  content: '🎅';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
}
@keyframes spin {
  from {
    transform: rotate(0deg)
  }
  to {
    transform: rotate(360deg)
  }
}
.vinyl-text {
  background: #000;
  padding: 6px 12px;
  border: 4px solid #8b4513;
  border-radius: 30px;
  margin-top: 10px;
  font-family: 'Segoe UI'
  , Arial
  , sans-serif;
  color: #ff4500;
  text-shadow: 0 0 10px #ff4500;
  pointer-events: none;
  /* Không chặn click phía sau */
}
/* Arrow hint pointing to record button */
.arrow-hint {
  position: absolute;
  left: 120px;
  bottom: 60px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 10px;
  border-radius: 16px;
  font-family: 'Segoe UI'
  , Arial
  , sans-serif;
  font-size: 14px;
  box-shadow: 0 0 10px rgba(255, 69, 0, 0.6);
  cursor: default;
  user-select: none;
  z-index: 99998;
  pointer-events: none;
  /* Không chặn click phía sau */
}

/* Overlay */
.christmas-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fadeIn 0.5s ease;
}
.christmas-overlay.fadeout {
  animation: fadeOut 0.5s ease forwards;
}
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
.christmas-popup-image {
  background: rgb(128, 0, 0);
  color: #fff;
  text-align: center;
  padding: 30px 20px;
  border-radius: 20px;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
  max-width: 400px;
  width: 90%;
  position: relative;
  animation: popupIn 0.8s ease;
}
.christmas-popup-image.popupout {
  animation: popupOut 0.8s ease forwards;
}
/* Responsive sizing */
@media (min-width: 768px) {
  .christmas-popup-image {
    max-width: 600px;
  }
}
@media (max-width: 767px) {
  .christmas-popup-image {
    max-width: 300px;
  }
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: #fff;
  color: #ff416c;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 18px;
  cursor: pointer;
  transition: 0.3s;
}
.close-btn:hover {
  background: #ffebee;
}
.close-countdown {
  position: absolute;
  top: 12px;
  right: 50px;
  background: rgba(255, 255, 255, 0.9);
  color: #ff416c;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Segoe UI'
  , Arial
  , sans-serif;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  display: none;
}
.popup-image {
  width: 100%;
  border-radius: 15px;
  margin: 20px 0;
  animation: gentlePulse 4s ease-in-out infinite;
  box-shadow: 0 0 30px rgba(255, 69, 0, 0.6);
}
.popup-title {
  font-size: 26px;
  color: #ffd700;
  font-family: 'Segoe UI'
  , Tahoma
  , Geneva
  , Verdana
  , sans-serif;
  text-shadow: 0 0 15px #ff4500;
}
@media (max-width: 768px) {
  .popup-title {
    font-size: 22px;
  }
}
.popup-subtext {
  font-size: 16px;
  color: #ffefd5;
  margin-top: 10px;
  font-family: 'Poppins'
  , 'Segoe UI'
  , sans-serif;
}
@media (max-width: 768px) {
  .popup-subtext {
  font-size: 14px;
  }
}

@keyframes gentlePulse {
  0,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes popupIn {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes popupOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.7);
    opacity: 0;
  }
}
@keyframes pulse {
  0,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Mobile tweaks */
@media (max-width: 767px) {
  .record {
    width: 50px;
    height: 50px;
    border-width: 5px;
    box-shadow: 0 0 15px #ff4500;
    bottom: 35px;
  }
  .record::after {
    font-size: 20px;
  }
  .vinyl-text {
    padding: 3px 6px;
    border-width: 3px;
    border-radius: 22px;
    font-size: 11px;
    position: relative;
    bottom: 35px;
  }
  .arrow-hint {
    left: 70px;
    bottom: 90px;
    font-size: 10px;
    padding: 4px 8px;
  }
  /* Khi menu mobile mở, ẩn các nút popup để không che menu */
  body.overflow-hidden .vintage-corner {
    display: none !important;
  }
  /* Hoặc điều chỉnh z-index thấp hơn menu mobile nếu muốn giữ hiển thị */
  body.overflow-hidden .vintage-corner .record,
  body.overflow-hidden .vintage-corner .arrow-hint {
    z-index: 9998 !important;
    /* Thấp hơn menu mobile (z-index: 9999) */
  }
}
/* Hiệu ứng nền mờ cho các nút trong header */
.header-group-icon .group-icon-item {
  background: rgba(255, 255, 255, 0.2);
  /* Nền trắng trong suốt */
  backdrop-filter: blur(6px);
  /* Làm mờ nền phía sau */
  -webkit-backdrop-filter: blur(6px);
  /* Hỗ trợ Safari */
  border-radius: 12px;
  /* Bo tròn nút */
  padding: 6px 10px;
  transition: all 0.3s ease;
}

/* Hiệu ứng hover */
.header-group-icon .group-icon-item:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* Icon bên trong */
.header-group-icon .box-icon svg,
.header-group-icon .box-icon img {
  filter: drop-shadow(0 0 3px rgba(255,255,255,0.6));
}

/* Đảm bảo hiệu ứng hiển thị rõ ràng trên nền tối */
@media (max-width: 768px) {
  .header-group-icon .group-icon-item {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.2);
  }
}
/* Giữ các nút header luôn nằm trên một hàng */
.header-group-icon {
  display: flex;
  align-items: center;
  flex-wrap: nowrap !important;
  gap: 6px;
  /* Tạo khoảng cách nhẹ giữa các nút */
}

/* Ngăn icon bị phình to do padding */
.header-group-icon .group-icon-item {
  flex-shrink: 0;
  /* Không co lại hoặc xuống dòng */
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 6px 8px;
  /* Giữ gọn kích thước */
  box-sizing: border-box;
  /* Tránh cộng padding vào width */
}

/* Tối ưu riêng cho màn hình nhỏ */
@media (max-width: 1400px) {
  .header-group-icon .group-icon-item {
    padding: 4px 6px;
    font-size: 12px;
  }
}
@media (max-width: 1160px) {
  .header-group-icon .group-icon-item {
    padding: 0;
    font-size: 10px;
  }
}
@media (max-width: 1000px) {
  .header-group-icon .group-icon-item {
    padding: 0;
    font-size: 7px;
  }
}

/* Điều chỉnh vị trí các nút floating khi nút "Thêm vào giỏ hàng" xuất hiện */
@media (max-width: 767px) {
  /* Khi nút "Thêm vào giỏ hàng" xuất hiện, đẩy các nút lên trên */
  .show-buy-mobile .fixed-action-btn {
    bottom: 225px !important;
    /* Đẩy nút SMS/Zalo lên trên */
    transition: bottom 0.3s ease;
  }

  .show-buy-mobile .back-to-top {
    bottom: 220px !important;
    /* Đẩy nút back to top lên trên */
    transition: bottom 0.3s ease;
  }

  /* Điều chỉnh vị trí Zalo chat widget */
  .show-buy-mobile .zalo-chat-widget {
    bottom: 170px !important;
    /* Đẩy Zalo widget lên trên */
    transition: bottom 0.3s ease;
  }

  /* Điều chỉnh vị trí Smax chat widget */
  .show-buy-mobile #smax-chat-widget {
    bottom: 100px !important;
    /* Đẩy Smax widget lên trên */
    transition: bottom 0.3s ease;
  }

  .show-buy-mobile #sm-chatbox-action {
    bottom: 120px !important;
    /* Đẩy Smax action button lên trên */
    transition: bottom 0.3s ease;
  }

  /* Điều chỉnh vị trí snow trên Zalo */
  .show-buy-mobile .snow-on-zalo {
    bottom: 185px !important;
    /* Đẩy snow lên theo Zalo */
    transition: bottom 0.3s ease;
  }

}

/* Ẩn text của nút giỏ hàng trên mobile, chỉ hiển thị icon */
@media (max-width: 768px) {
  .header-cart .box-text {
    display: none !important;
  }

  /* Đảm bảo nút giỏ hàng vẫn có kích thước phù hợp khi chỉ có icon */
  .header-cart .group-icon-item {
    min-width: 40px;
    padding: 8px;
  }
}

/* Ẩn floating buttons khi success add to cart modal hiện lên - Chỉ dùng CSS */
@media (max-width: 767px) {
  /* Ẩn các nút floating khi body có class active-success */
  body.active-success .zalo-chat-widget,
  body.active-success #smax-chat-widget,
  body.active-success #sm-chatbox-action,
  body.active-success .back-to-top,
  body.active-success .snow-on-zalo {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* Đảm bảo modal có z-index cao hơn */
  body.active-success .modal-backdrop.add-cart-mb {
    z-index: 9999 !important;
  }

  body.active-success #success-add-cart-mobile {
    z-index: 10000 !important;
  }

  /* Ẩn floating buttons khi modal backdrop có các class này */
  .modal-backdrop.fade.js-backdrop.open-quickview.in ~ .zalo-chat-widget,
  .modal-backdrop.fade.js-backdrop.open-quickview.in ~ #smax-chat-widget,
  .modal-backdrop.fade.js-backdrop.open-quickview.in ~ #sm-chatbox-action,
  .modal-backdrop.fade.js-backdrop.open-quickview.in ~ .back-to-top,
  .modal-backdrop.fade.js-backdrop.open-quickview.in ~ .snow-on-zalo {
    display: none !important;
  }

  /* Hoặc khi modal backdrop hiện lên */
  body:has(.modal-backdrop.fade.js-backdrop.open-quickview.in) .zalo-chat-widget,
  body:has(.modal-backdrop.fade.js-backdrop.open-quickview.in) #smax-chat-widget,
  body:has(.modal-backdrop.fade.js-backdrop.open-quickview.in) #sm-chatbox-action,
  body:has(.modal-backdrop.fade.js-backdrop.open-quickview.in) .back-to-top,
  body:has(.modal-backdrop.fade.js-backdrop.open-quickview.in) .snow-on-zalo {
    display: none !important;
  }

  /* Ẩn floating buttons khi success add to cart modal backdrop hiện lên */
  body:has(.modal-backdrop.add-cart-mb.in) .zalo-chat-widget,
  body:has(.modal-backdrop.add-cart-mb.in) #smax-chat-widget,
  body:has(.modal-backdrop.add-cart-mb.in) #sm-chatbox-action,
  body:has(.modal-backdrop.add-cart-mb.in) .back-to-top,
  body:has(.modal-backdrop.add-cart-mb.in) .snow-on-zalo {
    display: none !important;
  }

  /* Backup selector cho success modal */
  .modal-backdrop.add-cart-mb.in ~ .zalo-chat-widget,
  .modal-backdrop.add-cart-mb.in ~ #smax-chat-widget,
  .modal-backdrop.add-cart-mb.in ~ #sm-chatbox-action,
  .modal-backdrop.add-cart-mb.in ~ .back-to-top,
  .modal-backdrop.add-cart-mb.in ~ .snow-on-zalo {
    display: none !important;
  }

  /* Đảm bảo chức năng đẩy nút lên trên vẫn hoạt động khi KHÔNG có active-success */
  body.show-buy-mobile:not(.active-success) .zalo-chat-widget {
    bottom: 170px !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: bottom 0.3s ease;
  }

  body.show-buy-mobile:not(.active-success) #sm-chatbox-action {
    bottom: 120px !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: bottom 0.3s ease;
    /* Fix lệch logo và text khi bị đẩy lên */
    transform: scale(0.85) !important;
    transform-origin: bottom right !important;
    position: fixed !important;
    right: 10px !important;
    /* Đảm bảo căn chỉnh đúng */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  body.show-buy-mobile:not(.active-success) .back-to-top {
    bottom: 220px !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: bottom 0.3s ease;
  }

  body.show-buy-mobile:not(.active-success) #smax-chat-widget {
    bottom: 80px !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: bottom 0.3s ease;
    /* Fix lệch logo và text khi bị đẩy lên */
    transform: scale(0.80) !important;
    transform-origin: bottom right !important;
    position: fixed !important;
    right: 10px !important;
    /* Đảm bảo căn chỉnh đúng */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  body.show-buy-mobile:not(.active-success) .snow-on-zalo {
    bottom: 185px !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: none !important;
    transition: bottom 0.3s ease;
  }

  /* Backup: Reset transform nếu vẫn bị lệch */
  body.show-buy-mobile:not(.active-success) #sm-chatbox-action * {
    transform: none !important;
    position: relative !important;
  }

  body.show-buy-mobile:not(.active-success) #smax-chat-widget * {
    transform: none !important;
    position: relative !important;
  }
}