/* --- BẢO VỆ GIAO DIỆN KHỎI CSS MẶC ĐỊNH CỦA WP ADMIN --- */
.fs-plugin-wrapper *,
.fs-plugin-wrapper *::before,
.fs-plugin-wrapper *::after {
  box-sizing: border-box !important;
}
.fs-products-carousel .swiper-slide {
  min-width: 0 !important;
}

/* --- Áp dụng Font chữ cấu hình cho toàn khối --- */
.fs-font-custom,
.fs-font-custom * {
  font-family: var(--fs-font-family, Roboto, Arial, sans-serif) !important;
}
.fs-font-custom {
  font-size: var(--fs-font-size, 14px);
}

/* --- CẤU TRÚC BAO NGOÀI --- */
.fs-main-container {
  overflow: hidden;
  position: relative;
  border-radius: 12px;
  background-image: var(--fs-banner-pc);
  background-size: 100% 100%;
  background-position: center top;
}
.fs-top-header {
  display: flex;
  justify-content: space-between;
  align-items: center !important;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 18px !important;
  margin-bottom: 20px !important;
}

/* Chữ KẾT THÚC TRONG ăn theo đúng font-size 1em */
.fs-timer-label {
  font-size: 1em !important;
  margin: 0 !important;
  line-height: 1 !important;
  display: flex;
  align-items: center;
  font-weight: bold;
  text-shadow:
    1px 1px 4px rgba(0, 0, 0, 0.8),
    0 0 6px rgba(0, 0, 0, 0.5);
}

/* --- TABS CHIẾN DỊCH --- */
.fs-campaign-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center !important;
  margin-left: 25px !important;
}
.fs-tab-btn {
  background: var(--fs-tab-bg-inact, #ffffff) !important;
  color: var(--fs-tab-txt-inact, #333333) !important;
  border: var(--fs-tab-width, 1px) solid var(--fs-tab-border-inact, #dddddd) !important;
  padding: 8px 18px;
  border-radius: var(--fs-tab-radius, 20px) !important;
  font-weight: bold;
  font-size: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.fs-tab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.fs-tab-btn.active {
  background: var(--fs-tab-bg-act, #d70018) !important;
  color: var(--fs-tab-txt-act, #ffffff) !important;
  border-color: var(--fs-tab-border-act, #d70018) !important;
}

/* --- ẨN HIỆN THEO TAB --- */
.fs-timer-wrapper {
  display: none !important;
  align-items: center !important;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15) !important;
  padding: 6px 14px !important;
  border-radius: 30px !important;
  backdrop-filter: blur(4px);
  margin-right: 25px !important;
}
.fs-timer-wrapper.active {
  display: flex !important;
}
.fs-campaign-panel {
  display: none;
}
.fs-campaign-panel.active {
  display: block;
  animation: fadeIn 0.4s ease-in-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- SWIPER CAROUSEL --- */
.fs-products-carousel {
  overflow: hidden;
  width: 100%;
  padding: 30px 15px !important;
  margin: -15px -5px !important;
}
.swiper-wrapper {
  align-items: stretch !important;
}
.fs-products-carousel .swiper-button-next,
.fs-products-carousel .swiper-button-prev {
  background: rgba(255, 255, 255, 0.95) !important;
  width: 35px !important;
  height: 35px !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3) !important;
  color: #333 !important;
  margin-top: -15px !important;
  z-index: 20 !important;
}
.fs-products-carousel .swiper-button-next::after,
.fs-products-carousel .swiper-button-prev::after {
  font-size: 14px !important;
  font-weight: 900 !important;
}
.fs-products-carousel .swiper-button-disabled {
  display: none !important;
}

/* --- PRODUCT CARD --- */
.fs-product-card {
  background: #fff !important;
  border-radius: 10px !important;
  padding: 10px !important;
  position: relative;
  box-sizing: border-box;
  transition: box-shadow 0.3s ease !important;
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
}
.fs-product-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2) !important;
  z-index: 10;
}
.fs-product-image {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  overflow: hidden !important;
  border-radius: 8px !important;
  margin-bottom: 12px !important;
  background: #fff;
  aspect-ratio: 1/1 !important;
  width: 100% !important;
  flex-shrink: 0 !important;
}
.fs-product-image img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  transition: transform 0.4s ease !important;
  transform-origin: center center !important;
}
.fs-product-card:hover .fs-product-image img {
  transform: scale(1.15) !important;
}
.fs-flex-info {
  display: flex !important;
  flex-direction: column !important;
  flex-grow: 1 !important;
}
.fs-product-title {
  margin: 0 0 8px 0 !important;
  padding: 0 !important;
}
.fs-product-title a {
  font-size: 14px !important;
  line-height: 1.4 !important;
  color: #333 !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  white-space: normal !important;
}
.fs-price-box {
  margin-top: auto !important;
  margin-bottom: 10px !important;
}
.fs-price-sale,
.fs-price-sale * {
  color: #d70018 !important;
  font-weight: 800 !important;
  font-size: 16px !important;
}
.fs-price-regular del,
.fs-price-regular del * {
  color: #999 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.fs-badge-discount-wrapper {
  position: absolute;
  top: 15px;
  left: -6px;
  z-index: 10;
}
.fs-badge-discount {
  background: #d70018 !important;
  color: #fff !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  font-weight: bold !important;
  border-radius: 0 8px 8px 0 !important;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2) !important;
  position: relative;
  line-height: 1.2 !important;
}
.fs-badge-discount::before {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  border-top: 6px solid #8b0000;
  border-left: 6px solid transparent;
}

/* --- THANH TỒN KHO LỬA --- */
.fs-stock-bar {
  background-color: #ffdda1 !important;
  border-radius: 15px !important;
  height: 22px !important;
  position: relative;
  overflow: visible !important;
  margin-top: 5px !important;
  margin-bottom: 5px !important;
  margin-left: 8px !important;
}
.fs-stock-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #ff9900 0%, #ff5500 100%) !important;
  border-radius: 15px !important;
  z-index: 1;
}
.fs-fire-icon {
  position: absolute;
  left: -9px !important;
  top: 50% !important;
  transform: translateY(-56%) !important;
  font-size: 30px !important;
  z-index: 4 !important;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
}
.fs-stock-text {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 2 !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4) !important;
  padding-left: 10px !important;
  line-height: 1 !important;
}

/* --- TIMER STYLE (ĐỒNG HỒ) --- */
.flash-sale-timer {
  display: flex;
  gap: 6px;
  align-items: center;
}
.flash-sale-timer > span {
  display: flex !important;
  align-items: center !important;
  font-size: 1.1em !important;
  line-height: 1 !important;
} /* Dấu hai chấm */

/* Khối Basic */
.fs-basic-box {
  background: #fff !important;
  color: var(--fs-clock-color, #d70018) !important;
  font-size: 1.4em !important; /* To gấp 1.4 lần so với biến Cỡ Chữ gốc */
  font-weight: bold !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
  min-width: 2.2em !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.fs-basic-box small {
  display: none !important;
}

/* Khối Lật (Flip) */
.style-flip {
  gap: 8px;
}
.fs-flip-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.fs-flip-card {
  position: relative;
  background: #fff !important;
  color: var(--fs-clock-color, #d70018) !important;
  font-size: 1.5em !important;
  font-weight: bold !important;
  padding: 6px 6px !important;
  border-radius: 6px !important;
  min-width: 2.2em !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
  perspective: 1000px !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.fs-flip-card::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0, 0, 0, 0.2);
  z-index: 2;
}
.fs-flip-unit small {
  margin-top: 5px !important;
  font-size: 11px !important;
  font-weight: bold !important;
  color: #fff !important;
  text-transform: uppercase !important;
}
.fs-flip-card span {
  display: inline-block !important;
  transform-origin: center center !important;
}
@keyframes flipDown {
  0% {
    transform: rotateX(0deg);
  }
  50% {
    transform: rotateX(90deg);
    opacity: 0.5;
  }
  100% {
    transform: rotateX(0deg);
    opacity: 1;
  }
}
.fs-flip-card.flip-animate span {
  animation: flipDown 0.4s ease-in-out !important;
}

/* CHỐNG GIẬT F5 */
.fs-products-carousel:not(.swiper-initialized) .swiper-wrapper {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow: hidden !important;
  gap: 20px;
}
.fs-products-carousel:not(.swiper-initialized) .swiper-slide {
  width: calc(20% - 16px) !important;
  flex-shrink: 0 !important;
}
@media (max-width: 1024px) {
  .fs-products-carousel:not(.swiper-initialized) .swiper-slide {
    width: calc(33.333% - 10px) !important;
  }
}
@media (max-width: 640px) {
  .fs-products-carousel:not(.swiper-initialized) .swiper-slide {
    width: calc(50% - 5px) !important;
  }
}

/* --- TRANG CHI TIẾT SẢN PHẨM --- */
.fs-single-product-notice .fs-basic-box {
  font-size: 1.1em !important;
  padding: 3px 5px !important;
  min-width: 1.8em !important;
  border-radius: 4px !important;
}
.fs-single-product-notice .fs-flip-card {
  font-size: 1.2em !important;
  padding: 4px 4px !important;
  min-width: 1.8em !important;
  border-radius: 4px !important;
}
.fs-single-product-notice .flash-sale-timer {
  gap: 2px !important;
}
.fs-single-product-notice .flash-sale-timer > span {
  margin: 0 2px !important;
  font-size: 1em !important;
}
.fs-single-product-notice .style-flip {
  gap: 4px !important;
}
.fs-single-product-notice .fs-flip-unit small {
  font-size: 9px !important;
  margin-top: 3px !important;
}

@media (max-width: 768px) {
  .fs-single-product-notice {
    flex-direction: column !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 15px !important;
  }
}
/* ========================================= */
/* RESPONSIVE CHO ĐIỆN THOẠI (DƯỚI 768px)    */
/* ========================================= */
@media (max-width: 768px) {
    /* Đổi sang ảnh Banner dành riêng cho Mobile và tăng chiều cao */
    .fs-main-container {
        background-image: var(--fs-banner-mobile) !important;
        padding-top: 90px !important; /* ĐÃ THÊM: Tạo khoảng trống 120px ở trên cùng để lộ rõ chữ Chào Hè */
        padding-bottom: 30px !important;
        background-position: top center !important; 
    }

    /* Căn giữa đồng hồ và tab */
    .fs-top-header { 
        justify-content: center !important; 
        flex-direction: column; /* Xếp dọc Tab và Đồng hồ trên ĐT */
        margin-top: 0 !important; 
    }
    
    .fs-campaign-tabs, .fs-timer-wrapper { 
        margin-left: 0 !important; 
        margin-right: 0 !important; 
        justify-content: center !important;
    }
    
    /* Thu nhỏ đồng hồ một chút xíu nữa cho cân đối trên Mobile */
    .flash-sale-timer { transform: scale(0.9); }
}