/* ============================================================
   VI FEERIE — Trang Cửa hàng / Danh mục sản phẩm
   Dùng chung cho shop.html và category.html
   ============================================================ */

/* ---------------- Nội dung ẩn dành cho SEO ----------------
   Vẫn nằm trong DOM cho máy tìm kiếm đọc, nhưng không chiếm chỗ.
   Bỏ class này ra là nội dung hiện lên bình thường.          */
.seo-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------------- Đường dẫn (breadcrumb) ---------------- */
.crumbbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

/* Cho phép xuống dòng cả cụm. Không có flex-wrap thì các mục bị bóp lại
   và chữ trong từng nhãn tự bẻ đôi ("Trang / chủ"), nhìn rất vỡ ở khổ hẹp. */
.crumbbar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  padding-top: 13px;
  padding-bottom: 13px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* Các cấp ở giữa đều ngắn nên giữ nguyên dòng, không bẻ chữ */
.crumbbar__inner a {
  white-space: nowrap;
}

/* Riêng cấp cuối là tên sản phẩm, có thể dài — để nó tự xuống dòng
   thay vì đẩy tràn ngang. */
.crumbbar__inner [aria-current] {
  min-width: 0;
}

.crumbbar__inner a {
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.crumbbar__inner a:hover {
  color: var(--brand-deep);
}

.crumbbar__inner [aria-current] {
  color: var(--ink);
  font-weight: 600;
}

.crumbbar__sep {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  color: var(--brand-light);
}

/* ---------------- Ảnh bìa (chỉ ảnh, không chữ) ---------------- */
/* Nền dải màu nằm dưới ảnh, để lúc ảnh chưa tải xong
   dải hero vẫn ra màu thương hiệu chứ không trắng trơn. */
.shophero {
  display: block;
  max-height: 400px;
  overflow: hidden;
  background: linear-gradient(100deg, var(--brand-tint) 0%, var(--brand-soft) 55%, var(--brand-blue) 100%);
}

/* Ảnh gốc là 1.79:1. Chiều cao dưới đây chọn theo từng khổ màn hình sao cho
   phần cắt luôn ôm trọn vòng cung sản phẩm, không chặt mất mép trên dưới. */
.shophero__img {
  display: block;
  width: 100%;
  height: 400px;
  max-height: 400px;
  object-fit: cover;
  object-position: center 48%;
}

/* ---------------- Khung 2 cột ---------------- */
.shop__row {
  display: grid;
  grid-template-columns: 272px 1fr;
  gap: 40px;
  align-items: start;
}

.shop__main {
  min-width: 0;
}

.shop__archive-head {
  margin-bottom: 28px;
}

.shop__archive-label {
  margin-bottom: 6px;
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.shop__archive-head h1 {
  color: var(--ink);
  font: 500 clamp(28px, 3vw, 38px)/1.25 var(--font-display);
}

.shop__archive-description {
  max-width: 68ch;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.shop__archive-description > * + * {
  margin-top: 8px;
}

/* ============================================================
   CỘT TRÁI — BỘ LỌC
   ============================================================ */
.shopfilter {
  position: sticky;
  top: calc(var(--navbar-h) + 20px);
  min-width: 0;
}

.shopfilter__sheet {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

/* Thanh tiêu đề bộ lọc */
.shopfilter__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.shopfilter__heading {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}

.shopfilter__reset {
  font-size: 12.5px;
  color: var(--brand-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s var(--ease), opacity 0.2s var(--ease);
}

.shopfilter__reset:hover {
  color: var(--ink);
}

.shopfilter__reset:disabled {
  opacity: 0.35;
  cursor: default;
  text-decoration: none;
}

/* Nút đóng — chỉ dùng ở dạng ngăn kéo trên tablet/mobile */
.shopfilter__close {
  display: none;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.shopfilter__close:hover {
  background: var(--brand-tint);
  color: var(--ink);
}

.shopfilter__close svg {
  width: 17px;
  height: 17px;
}

/* Chân ngăn kéo — chỉ hiện trên tablet/mobile */
.shopfilter__foot {
  display: none;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

/* Lớp phủ mờ phía sau ngăn kéo.
   Header đang ở z-index 200 và menu di động ở 300, nên ngăn kéo bộ lọc
   phải nằm trên cả hai, nếu không sẽ bị header che mất thanh tiêu đề. */
.shopfilter__scrim {
  position: fixed;
  inset: 0;
  z-index: 310;
  background: rgba(41, 24, 33, 0.45);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.shopfilter__scrim.is-shown {
  opacity: 1;
}

/* ---------------- Nhóm lọc gập/mở ---------------- */
.fgroup {
  border-bottom: 1px solid var(--line);
}

.fgroup:last-child {
  border-bottom: 0;
}

.fgroup__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  transition: background 0.2s var(--ease);
}

.fgroup__head:hover {
  background: var(--brand-tint);
}

.fgroup__title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.fgroup__caret {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  color: var(--muted);
  transition: transform 0.28s var(--ease);
}

.fgroup.is-closed .fgroup__caret {
  transform: rotate(-90deg);
}

/* Gập bằng grid-template-rows để không phải đo chiều cao */
.fgroup__panel {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s var(--ease);
}

.fgroup.is-closed .fgroup__panel {
  grid-template-rows: 0fr;
}

.fgroup__inner {
  min-height: 0;
  overflow: hidden;
}

.fgroup__inner > :last-child {
  margin-bottom: 0;
  padding-bottom: 16px;
}

/* ---------------- Danh mục (bấm là chuyển trang) ---------------- */
.fcat {
  padding: 0 8px 0;
}

.fcat__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.fcat__link:hover {
  background: var(--brand-tint);
  color: var(--brand-deep);
}

.fcat__link.is-current {
  background: var(--brand-tint);
  color: var(--brand-deep);
  font-weight: 700;
}

.fcat__count {
  flex-shrink: 0;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

.fcat__link.is-current .fcat__count {
  background: var(--brand-deep);
  color: #fff;
}

/* ---------------- Thanh trượt khoảng giá ---------------- */
.fprice {
  position: relative;
  height: 30px;
  margin: 4px 16px 0;
}

.fprice__track {
  position: absolute;
  top: 13px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
}

.fprice__fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--brand-deep);
}

/* Hai thanh range chồng lên nhau, chỉ nút kéo nhận chuột */
.fprice__range {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 30px;
  margin: 0;
  background: none;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

.fprice__range::-webkit-slider-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border: 2px solid var(--brand-deep);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(56, 34, 19, 0.2);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.fprice__range::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border: 2px solid var(--brand-deep);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(56, 34, 19, 0.2);
  cursor: pointer;
}

.fprice__range::-moz-range-track {
  background: none;
}

.fprice__out {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 16px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.fprice__dash {
  color: var(--muted);
  font-weight: 400;
}

/* ---------------- Ô tick ---------------- */
.fcheck {
  padding: 0 16px;
}

.fcheck__row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 0;
  cursor: pointer;
}

.fcheck__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.fcheck__box {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border: 1.4px solid var(--brand-light);
  border-radius: 4px;
  background: #fff;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.fcheck__box svg {
  width: 11px;
  height: 11px;
  color: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
  stroke-width: 2.6;
}

.fcheck__input:checked + .fcheck__box {
  border-color: var(--brand-deep);
  background: var(--brand-deep);
}

.fcheck__input:checked + .fcheck__box svg {
  opacity: 1;
  transform: scale(1);
}

.fcheck__input:focus-visible + .fcheck__box {
  outline: 2px solid var(--brand-deep);
  outline-offset: 2px;
}

.fcheck__label {
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
  transition: color 0.2s var(--ease);
}

.fcheck__row:hover .fcheck__label {
  color: var(--brand-deep);
}

.fcheck__input:checked ~ .fcheck__label {
  font-weight: 600;
  color: var(--ink);
}

.fcheck__count {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------------- Bảng màu ---------------- */
.fcolor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  padding: 2px 16px 0;
}

.fcolor__item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.fcolor__item:hover {
  background: var(--brand-tint);
}

.fcolor__item[aria-pressed="true"] {
  border-color: var(--brand-deep);
  background: var(--brand-tint);
  font-weight: 600;
  color: var(--ink);
}

.fcolor__dot {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(56, 34, 19, 0.14);
}

.fcolor__name {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ============================================================
   CỘT PHẢI — THANH CÔNG CỤ + LƯỚI
   ============================================================ */
.shop__toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

/* Nút mở bộ lọc — chỉ hiện từ tablet trở xuống */
.shop__filterbtn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.shop__filterbtn:hover {
  border-color: var(--brand-light);
  background: var(--brand-tint);
}

.shop__filterbtn svg {
  width: 16px;
  height: 16px;
  color: var(--brand-deep);
}

.shop__filterbtn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-deep);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.shop__count {
  flex: 1;
  font-size: 13.5px;
  color: var(--muted);
}

.shop__count strong {
  color: var(--ink);
  font-weight: 600;
}

/* Ô sắp xếp */
.shop__sort {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.shop__sort-label {
  font-size: 13px;
  color: var(--muted);
}

.shop__sort select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s var(--ease);
}

.shop__sort select:hover,
.shop__sort select:focus {
  border-color: var(--brand-light);
  outline: none;
}

.shop__sort-caret {
  position: absolute;
  right: 11px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}

/* ---------------- Chip tiêu chí đang chọn ---------------- */
.shop__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

/* display ở trên thắng [hidden] của trình duyệt nên phải ẩn lại bằng tay */
.shop__chips[hidden] {
  display: none;
}

.shop__chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px 5px 12px;
  border: 1px solid var(--brand-light);
  border-radius: 999px;
  background: var(--brand-tint);
  font-size: 12.5px;
  color: var(--brand-deep);
}

.shop__chip button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: var(--brand-deep);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.shop__chip button:hover {
  background: var(--brand-deep);
  color: #fff;
}

.shop__chip svg {
  width: 10px;
  height: 10px;
  stroke-width: 2.4;
}

/* ---------------- Lưới sản phẩm ---------------- */
.shop__body {
  position: relative;
  min-height: 260px;
}

.shop__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  transition: opacity 0.25s var(--ease);
}

.shop__body.is-loading .shop__grid {
  opacity: 0.35;
  pointer-events: none;
}

.shop__item.is-hidden {
  display: none;
}

/* Hiện dần từng thẻ sau khi lọc xong */
@keyframes shopIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.shop__item.is-entering {
  animation: shopIn 0.42s var(--ease) both;
}

/* ---------------- Lớp phủ đang tải ---------------- */
.shop__veil {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding-top: 90px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(1px);
}

/* Cùng lý do: không có dòng này thì lớp phủ hiện ngay từ lúc mới tải trang */
.shop__veil[hidden] {
  display: none;
}

.shop__spinner {
  width: 30px;
  height: 30px;
  border: 2.5px solid var(--brand-light);
  border-top-color: var(--brand-deep);
  border-radius: 50%;
  animation: shopSpin 0.7s linear infinite;
}

@keyframes shopSpin {
  to { transform: rotate(360deg); }
}

.shop__veil-text {
  font-size: 13px;
  color: var(--brand-deep);
  letter-spacing: 0.02em;
}

/* ---------------- Không có kết quả ---------------- */
.shop__empty {
  padding: 60px 20px;
  text-align: center;
  font-size: 14.5px;
  color: var(--muted);
}

/* ---------------- Phân trang ---------------- */
.shop__pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 44px;
}

.shop__page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.shop__page:hover:not(:disabled):not(.is-current) {
  border-color: var(--brand-light);
  color: var(--brand-deep);
}

.shop__page.is-current {
  border-color: var(--brand-deep);
  background: var(--brand-deep);
  color: #fff;
  font-weight: 600;
}

.shop__page:disabled {
  opacity: 0.35;
  cursor: default;
}

.shop__page svg {
  width: 15px;
  height: 15px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media screen and (max-width: 1200px) {
  .shop__row {
    grid-template-columns: 248px 1fr;
    gap: 28px;
  }

  .shop__grid {
    gap: 16px;
  }
}

/* Từ đây header đổi kiểu dính: navbar ẩn, midbar dính lại */
@media screen and (max-width: 1050px) {
  .shopfilter {
    top: calc(var(--midbar-h) + 18px);
  }
}

/* ---------------- Tablet & mobile: bộ lọc thành ngăn kéo ---------------- */
@media screen and (max-width: 900px) {
  .shophero__img {
    height: 300px;
  }

  .shop__row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .shop__filterbtn {
    display: inline-flex;
  }

  .shop__count {
    font-size: 12.5px;
  }

  .shop__sort-label {
    display: none;
  }

  /* Ngăn kéo trượt từ trái vào */
  .shopfilter {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 320;
    width: min(340px, 88vw);
    transform: translateX(-100%);
    transition: transform 0.32s var(--ease);
  }

  .shopfilter.is-open {
    transform: none;
  }

  .shopfilter__sheet {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: 6px 0 28px rgba(56, 34, 19, 0.16);
  }

  /* Chỉ vùng giữa cuộn, thanh tiêu đề và nút áp dụng đứng yên */
  .shopfilter__bar,
  .shopfilter__foot {
    flex-shrink: 0;
  }

  .shopfilter__close,
  .shopfilter__foot {
    display: flex;
  }

  .shopfilter__scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .shopfilter__scrim[hidden] {
    display: none;
  }

  /* Cụm icon liên hệ nằm ở z-index 999 nên phải cho nó lùi đi,
     không thì nó nổi đè lên lớp phủ của ngăn kéo. */
  body.has-filter-open .sticky-contact {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
  }
}

@media screen and (max-width: 820px) {
  .shop__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .shop__toolbar {
    gap: 10px;
  }
}

@media screen and (max-width: 560px) {
  .crumbbar__inner {
    padding-top: 11px;
    padding-bottom: 11px;
    font-size: 12px;
  }

  .shophero__img {
    height: 210px;
  }

  .shop__toolbar {
    flex-wrap: wrap;
  }

  .shop__count {
    order: 3;
    flex-basis: 100%;
    font-size: 12px;
  }

  .shop__sort select {
    padding: 7px 28px 7px 10px;
    font-size: 12.5px;
  }

  .shop__grid {
    gap: 12px;
  }

  .shop__pager {
    margin-top: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shop__item.is-entering,
  .shop__spinner {
    animation: none !important;
  }

  .shopfilter,
  .fgroup__panel {
    transition: none !important;
  }
}

/* WordPress archive integration: match the static layout's 1400px container. */
.woocommerce-main.vifeerie-shop-main .container { max-width: 1400px; }
.vifeerie-shop-main .shop__row { padding-top: 0; }
.shophero picture { display: block; max-height: 400px; overflow: hidden; }
.shopfilter__foot { display: flex; }
.shopfilter__foot .btn { width: 100%; }
.fcat__link--child { padding-left: 22px; }
.fcolor__item { cursor: pointer; }
.fcolor__input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fcolor__input:checked + .fcolor__dot { outline: 2px solid var(--brand-deep); outline-offset: 2px; }
.fcolor__item:has(.fcolor__input:checked) { border-color: var(--brand-deep); background: var(--brand-tint); font-weight: 600; }
.fcolor__item:has(.fcolor__input:focus-visible) { outline: 2px solid var(--brand-deep); outline-offset: 2px; }
.fcolor__dot { overflow: hidden; background: var(--brand-tint); }
.fcolor__dot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shop__grid > .pcard { min-width: 0; }
.shop__chip { text-decoration: none; }
.shop__chip span[aria-hidden] { font-size: 16px; line-height: 1; }
.shop__page.current { border-color: var(--brand-deep); background: var(--brand-deep); color: #fff; font-weight: 600; }
.shop__page.dots { border: 0; background: transparent; }
.shop__page.prev, .shop__page.next { width: auto; }
