/*
  Giao diện Forseti 2026 - lớp làm mới theo phong cách siêu thị bán hàng.
  Tải sau custom.css (snippets/head-styles.bwt), chỉ đè giao diện, không đổi cấu trúc.
  Màu thương hiệu: đỏ #ee1f19, xanh #054cae.
  Biến đặt trên body (không đặt trên :root) vì css-variables.bwt in :root sau file này.
*/
body.ega-theme {
  --brand-blue: #054cae;
  --brand-blue-dark: #033b8a;
  --brand-blue-50: #eef4fd;
  --brand-blue-100: #d9e6fa;
  --brand-red: #ee1f19;
  --brand-red-dark: #c8140f;
  --brand-red-50: #fff0ef;
  --surface-border: #e4e9f1;
  --text-muted: #5b6577;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-card-hover: 0 14px 32px rgba(5, 76, 174, 0.14);
  --rounded: 1.2rem;
  --rounded-button: 0.8rem;
  --rounded-input: 0.8rem;
}

/* ---------- Header ---------- */
.header {
  background: #fff;
}

.header .search-bar form {
  border: 1px solid var(--brand-blue-100);
  background: #f7faff;
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.header .search-bar form:focus-within {
  border-color: var(--brand-blue);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-blue-50);
}

/* Nút tìm: trong suốt, chỉ icon xanh */
.header .search-bar .search-button {
  background: transparent;
  color: var(--brand-blue) !important;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.header .search-bar .search-button:hover {
  background: var(--brand-blue-50);
  filter: none;
}

.header .header-icon-group .header-icon {
  background: var(--brand-blue-50);
  color: var(--brand-blue);
  border: 0 !important;
  border-radius: 9999px;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.header .header-icon-group:hover {
  background: transparent;
}

.header .header-icon-group:hover .header-icon {
  background: var(--brand-blue-100);
}

.header .header-icon-group .text-xs {
  color: var(--text-muted);
  font-size: 1.3rem !important;
}

.header .cart-count {
  width: 1.8rem;
  height: 1.8rem;
  font-size: 1.1rem;
  top: -2px;
  right: -2px;
  box-shadow: 0 0 0 2px #fff;
}

/* ---------- Thanh menu: nền trắng, gạch chân xanh khi rê chuột ---------- */
.navigation-wrapper.sub-header {
  max-width: none;
  background: #fff;
  color: var(--color-foreground);
  border-top: 1px solid #eef1f6;
  border-bottom: 1px solid #eef1f6;
}

.sub-header .navigation-horizontal > .menu-item > a {
  position: relative;
  padding: 1.3rem 1.8rem;
  color: var(--color-foreground);
  font-weight: 500;
  transition: color 0.2s ease;
}

.sub-header .navigation-horizontal > .menu-item > a::after {
  content: '';
  position: absolute;
  left: 1.8rem;
  right: 1.8rem;
  bottom: 0;
  height: 2px;
  border-radius: 9999px;
  background: var(--brand-blue);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.sub-header .navigation-horizontal > .menu-item:hover > a {
  color: var(--brand-blue);
}

.sub-header .navigation-horizontal > .menu-item:hover > a::after {
  transform: scaleX(1);
}

.sub-header .navigation-horizontal .submenu {
  color: var(--color-foreground);
  border-radius: 0 0 1.2rem 1.2rem;
  overflow: hidden;
  box-shadow: 0 16px 32px rgba(16, 24, 40, 0.16);
}

.sub-header .navigation-horizontal .submenu a:hover {
  color: var(--brand-blue);
  background: var(--brand-blue-50);
}

.sub-header .navigation-header [data-portal='#menu-drawer'] {
  width: fit-content;
  padding: 0.6rem 1.6rem;
  border-radius: 0.8rem;
  background: var(--brand-blue-50);
  color: var(--brand-blue);
}

/* Hotline: nền đỏ rất nhạt, chữ đỏ */
.sub-header .phone-group {
  padding: 0.5rem 1.4rem;
  border: 1px solid #fcd5d3;
  border-radius: 9999px;
  background: var(--brand-red-50);
  color: var(--brand-red) !important;
  font-weight: 500;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.sub-header .phone-group:hover {
  background: #ffe4e2;
  border-color: #f9b9b6;
}

.sub-header .phone-group b {
  font-weight: 700;
}

.sub-header .store-group:hover {
  color: var(--brand-blue) !important;
}

#menu-drawer {
  color: var(--color-foreground);
}

/* ---------- Tiêu đề khối ---------- */
.heading-bar {
  text-align: left;
  margin-bottom: 0;
}

.heading {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding-left: 1.4rem;
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1.3;
  color: #13315c;
  background: transparent;
  text-align: left;
}

.heading::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 9999px;
  background: var(--brand-red);
}

.heading a:hover {
  color: var(--brand-blue);
  opacity: 1;
}

@media (max-width: 767px) {
  .heading,
  .heading-bar .heading {
    font-size: 2rem;
    padding: 0 0 0 1.2rem;
  }

  .heading::before {
    width: 4px;
  }
}

/* ---------- Khối chính sách (Chính hãng, Bảo hành...) ---------- */
.section-polices .embla__container {
  gap: 1.2rem;
}

.section-polices .embla__container > .embla__slide {
  align-items: center;
  gap: 1.4rem;
  margin: 0;
  padding: 1.6rem 2rem;
  background: #fff;
  border: 1px solid var(--surface-border);
  border-radius: 1.2rem;
}

/* Màn hình lớn: 4 ô chia đều, trừ 3 khoảng cách để ô cuối không tràn khung */
@media (min-width: 1270px) {
  .section-polices .embla__container > .embla__slide {
    width: calc((100% - 3 * 1.2rem) / 4);
  }
}

@media (max-width: 767px) {
  .section-polices .embla__container > .embla__slide {
    padding: 1.4rem 1.6rem;
  }
}

.section-polices .embla__slide > div:first-child {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.4rem;
  height: 4.4rem;
  border-radius: 9999px;
  background: var(--brand-blue-50);
}

.section-polices .embla__slide .font-semibold {
  color: var(--brand-blue);
}

.section-polices .embla__slide .text-xs {
  color: var(--text-muted);
}

/* ---------- Danh mục sản phẩm ---------- */
.section-collection-list .collection-list {
  gap: 1.2rem;
  padding: 0.4rem 0 0.8rem;
}

/* Ảnh danh mục có sẵn nền xám nhạt nên ô giữ nền trong suốt, chỉ nhấc lên khi rê chuột */
.section-collection-list .collection-item {
  border-radius: 1.2rem;
  min-width: 10.4rem;
  transition: transform 0.2s ease;
}

.section-collection-list .collection-item:hover {
  filter: none;
  transform: translateY(-3px);
}

.section-collection-list .collection-item span {
  transition: color 0.2s ease;
}

.section-collection-list .collection-item:hover span {
  color: var(--brand-blue);
}

@media (max-width: 767px) {
  .section-collection-list .collection-list {
    gap: 0.8rem;
  }
}

/* ---------- Khối sản phẩm: nền trắng bo góc ---------- */
.section-product-tabs .section-card {
  padding: 2.4rem;
  background: #fff;
  border-radius: 1.6rem;
  box-shadow: var(--shadow-card);
}

@media (max-width: 767px) {
  .section-product-tabs .section-card {
    padding: 1.6rem 1.2rem;
    border-radius: 1.2rem;
  }
}

/* Khối sản phẩm kèm banner (vd. Nước kiềm tính) không có khung trắng: cách khối trên xa hơn */
.section-product-tabs:not(:has(.section-card)) {
  margin-top: 4.8rem;
}

/* Không có tab: bỏ khoảng trống thừa giữa tiêu đề và sản phẩm */
.section-product-tabs .heading-tabs--empty {
  margin-top: 0;
  margin-bottom: 1.6rem;
}

@media (max-width: 767px) {
  .section-product-tabs:not(:has(.section-card)) {
    margin-top: 3.2rem;
  }
}

.section-product-tabs .product-list {
  gap: 1.2rem;
  margin-top: 1.6rem;
}

@media (max-width: 767px) {
  .section-product-tabs .product-list {
    gap: 0.8rem;
    margin-top: 1.2rem;
  }
}

/* Tab dạng viên thuốc */
.tab-nav--style4 .tab-btn {
  padding: 0.7rem 1.8rem;
  border: 1px solid var(--surface-border);
  border-radius: 9999px;
  background: #fff;
  color: var(--color-foreground);
  font-size: 1.4rem;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.tab-nav--style4 .tab-btn:hover {
  background: var(--brand-blue-50);
  border-color: var(--brand-blue-100);
  color: var(--brand-blue);
}

/* Tab đang chọn: nền xanh nhạt, chữ xanh (không tô đặc) */
.tab-nav--style4 .active,
.tab-nav--style4 .active:hover {
  background: var(--brand-blue-50);
  border-color: #b9cff2;
  color: var(--brand-blue);
}

/* Nút Xem tất cả: viền mảnh, trong suốt */
.tab-viewmore {
  width: fit-content !important;
  margin-left: auto;
  margin-right: auto;
  margin-top: 2rem;
  padding: 0.8rem 2.6rem !important;
  border: 1px solid var(--brand-blue-100) !important;
  border-radius: 9999px;
  color: var(--brand-blue);
  font-weight: 500 !important;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.tab-viewmore:hover {
  background: var(--brand-blue-50);
  border-color: #b9cff2 !important;
  color: var(--brand-blue);
}

/* ---------- Thẻ sản phẩm ---------- */
.card-product--vertical {
  border: 1px solid var(--surface-border);
  border-radius: 1.2rem;
  background: #fff;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.card-product--vertical form {
  background: transparent;
}

.card-product--vertical:after {
  content: none;
}

@media (hover: hover) and (min-width: 1024px) {
  .card-product--vertical:hover {
    border-color: var(--brand-blue-100);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-3px);
  }
}

.card-product__title {
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--color-foreground);
  transition: color 0.2s ease;
}

.card-product:hover .card-product__title {
  color: var(--brand-blue);
}

.card-product .price {
  color: var(--brand-red);
  font-weight: 700;
}

.card-product .compare-price {
  font-size: 1.3rem;
}

/* Nhãn % giảm: nền đỏ nhạt, chữ đỏ */
.sale-badge {
  --color-badge-bg: var(--brand-red-50);
  --color-badge: var(--brand-red);
  border-radius: 0.4rem;
  font-weight: 600;
}

.card-product .addtocart-btn {
  border-radius: 9999px;
  background: var(--brand-red-50);
  color: var(--brand-red);
  transition: background-color 0.2s ease;
}

.card-product .addtocart-btn:hover {
  background: #ffe0de;
  filter: none;
}

.card-product__utilites button {
  box-shadow: var(--shadow-card);
}

/* ---------- Nút Sao chép mã giảm giá: viền xanh, nền trong suốt ---------- */
.coupon-item .copy-button:not(.coupon-expired) {
  border-color: #b9cff2 !important;
  border-radius: 9999px;
  background: #fff !important;
  color: var(--brand-blue) !important;
  transition: background-color 0.2s ease;
}

.coupon-item .copy-button:not(.coupon-expired):hover {
  background: var(--brand-blue-50) !important;
  filter: none;
}

/* ---------- Khối "Sản phẩm nổi bật" trên trang chủ (featured-product.bwt) ---------- */
/* .section.x để thắng rule .section in sau trong css-variables.bwt */
.section.section-home-product {
  margin-top: 3.2rem;
}

/* Màn hình lớn: khung ảnh và khung thông tin cao bằng nhau, ảnh căn giữa theo chiều dọc */
@media (min-width: 1024px) {
  .product-shortcode .product-gallery-wrapper {
    grid-row: 1 / 5;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-shortcode .product-gallery-wrapper > div {
    width: 100%;
  }
}

/*
  ---------- Bộ chọn ngày (ô "Nhận tại cửa hàng", hẹn giao hàng) ----------
  CSS đầy đủ của lịch (defer-vendors.css) chỉ tải sau lần tương tác đầu tiên.
  Trước đó lịch đã được tạo nên hiện trần, dàn số ngày tràn khung sản phẩm.
  Các dòng dưới tải ngay: lịch luôn ẩn tới khi bấm vào ô, và nổi lên thay vì đẩy nội dung.
*/
.datepicker-input {
  position: relative;
  display: block;
}

.datepicker:not(.active) {
  display: none;
}

.datepicker-dropdown {
  position: absolute;
  z-index: 20;
  padding-top: 4px;
}

.datepicker-input .datepicker-picker {
  overflow: hidden;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14);
}

.datepicker-input .datepicker-cell.today:not(.selected) {
  background-color: var(--brand-blue-50);
  color: var(--brand-blue);
}

.datepicker-input .form-input {
  border-radius: 0.8rem;
}

/* ---------- Nút chung ---------- */
.btn.bg-primary:hover,
.button_subscribe:hover {
  filter: none;
  background-color: var(--brand-blue-dark);
}

/* ---------- Mô tả danh mục (nội dung SEO dưới lưới sản phẩm) ----------
   Nhịp khoảng cách đều: đoạn 1.4rem, ảnh/bảng 2.4rem, mỗi mục H2 tách bằng đường kẻ. */
.collection-desc.bg-background {
  padding: 3.2rem 4rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--rounded);
  box-shadow: var(--shadow-card);
}

.collection-desc .prose {
  color: #2b3445;
  font-size: 1.6rem;
  line-height: 1.75;
}

.collection-desc .prose > :first-child {
  margin-top: 0;
}

.collection-desc .prose p {
  margin: 0 0 1.4rem;
}

.collection-desc .prose h2 {
  margin: 4rem 0 1.6rem;
  padding-top: 3.2rem;
  border-top: 1px solid var(--surface-border);
  color: #0f1f3d;
  font-size: 2.4rem;
  line-height: 1.35;
}

.collection-desc .prose h3 {
  margin: 2.4rem 0 0.8rem;
  color: #0f1f3d;
  font-size: 1.8rem;
  line-height: 1.4;
}

.collection-desc .prose h2 + p,
.collection-desc .prose h3 + p {
  margin-top: 0;
}

.collection-desc .prose ul,
.collection-desc .prose ol {
  margin: 0 0 1.8rem;
  padding-left: 2.2rem;
}

.collection-desc .prose li {
  margin: 0 0 0.8rem;
  padding-left: 0.4rem;
}

.collection-desc .prose li::marker {
  color: var(--brand-blue);
}

.collection-desc .prose strong {
  color: #0f1f3d;
}

.collection-desc .prose a {
  color: var(--brand-blue);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--brand-blue-100);
  text-underline-offset: 0.3rem;
}

.collection-desc .prose a:hover {
  text-decoration-color: var(--brand-blue);
}

.collection-desc .prose a strong {
  color: inherit;
}

/* Ảnh: đoạn chứa ảnh cách đều trên dưới, chú thích (đoạn chỉ có chữ nghiêng) sát ngay dưới ảnh */
.collection-desc .prose p:has(> img) {
  margin: 2.4rem 0 0.8rem;
}

.collection-desc .prose img {
  display: block;
  width: auto;
  max-width: min(100%, 64rem);
  height: auto;
  margin: 0 auto;
  border-radius: 1.2rem;
}

.collection-desc .prose p:has(> img) + p:not(:has(> em:only-child)) {
  margin-top: 2.4rem;
}

.collection-desc .prose p:has(> em:only-child) {
  margin: 0 0 2.4rem;
  color: var(--text-muted);
  font-size: 1.4rem;
}

.collection-desc .prose p:has(> em:only-child) em {
  font-style: normal;
}

/* Bảng: khung bo góc, hàng đầu làm tiêu đề cột */
.collection-desc .prose table {
  width: 100%;
  margin: 2rem 0 2.4rem;
  border: 1px solid var(--surface-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 1.2rem;
  overflow: hidden;
  font-size: 1.5rem;
  line-height: 1.55;
}

.collection-desc .prose td,
.collection-desc .prose th {
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid var(--surface-border);
  vertical-align: top;
  text-align: left;
}

.collection-desc .prose tr:last-child td {
  border-bottom: 0;
}

.collection-desc .prose td + td {
  border-left: 1px solid var(--surface-border);
}

.collection-desc .prose tr:first-child td,
.collection-desc .prose th {
  background: var(--brand-blue-50);
  color: var(--brand-blue-dark);
  font-weight: 700;
}

.collection-desc .prose table + p {
  margin-top: 0;
}

@media (max-width: 767px) {
  .collection-desc.bg-background {
    padding: 2rem 1.6rem;
  }

  .collection-desc .prose {
    font-size: 1.5rem;
  }

  .collection-desc .prose h2 {
    margin-top: 3.2rem;
    padding-top: 2.4rem;
    font-size: 2rem;
  }

  .collection-desc .prose h3 {
    font-size: 1.7rem;
  }

  /* Bảng nhiều cột: vuốt ngang thay vì bóp chữ */
  .collection-desc .prose table {
    display: block;
    overflow-x: auto;
    font-size: 1.4rem;
  }

  .collection-desc .prose td,
  .collection-desc .prose th {
    min-width: 14rem;
    padding: 1rem 1.2rem;
  }
}
