/* Product-first storefront, dùng chung cho cả WordPress/WooCommerce theme và bản Preview local. */

.catalog-page {
  padding: 24px 0 48px;
  background: var(--lka-soft);
  overflow-x: hidden;
}

/* Quick Categories Bar */
.catalog-categories {
  padding: 22px;
  margin-bottom: 20px;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  background: #fff;
  scroll-margin-top: 160px;
}

.catalog-section-head,
.catalog-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.catalog-eyebrow {
  color: #a84a32;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.catalog-section-head h2 {
  margin: 2px 0 0;
  font-size: 21px;
  letter-spacing: -0.5px;
}

.text-button {
  padding: 10px 0 10px 10px;
  color: #d53c1e;
  background: none;
  border: 0;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.quick-categories {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.quick-category {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--lka-ink);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
}

.quick-category:hover,
.quick-category.selected {
  color: #c6391e;
  border-color: #ffcabc;
  background: #fff5f1;
}

.quick-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 14px;
  color: #d84a2c;
  background: #fff0ea;
}

.quick-category:nth-child(3n + 2) .quick-icon {
  color: #347b8d;
  background: #edf6f7;
}

.quick-category:nth-child(3n) .quick-icon {
  color: #997029;
  background: #fcf5e7;
}

.quick-icon svg,
.category-trigger svg,
.mobile-nav svg,
.category-all svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sticky Catalogue Header & Ordering Controls */
.catalog-results {
  margin-top: 20px;
}

.catalog-sticky-bar {
  position: sticky;
  top: var(--catalog-sticky-top, 126px);
  z-index: 40;
  padding: 14px 0 10px;
  margin-bottom: 14px;
  background: var(--lka-soft);
  box-shadow: 0 8px 10px -10px #25303b45;
}

.catalog-sticky-bar::after {
  content: "";
  display: block;
  clear: both;
}

.catalog-sticky-bar :is(.catalog-title-row, .catalog-heading, .woocommerce-products-header) h1 {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.3px;
  color: #263440;
  -webkit-font-smoothing: antialiased;
}

.catalog-title-row p,
.catalog-sticky-bar .woocommerce-result-count {
  margin: 4px 0 0;
  color: #6f7279;
  font-size: 13px;
  float: none !important;
}

.catalog-tag {
  color: #85858b;
  font-size: 12px;
}

.catalog-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 0;
}

.catalog-tools .woocommerce-ordering {
  float: none !important;
  margin: 0 !important;
}

.category-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid #dedede;
  border-radius: 8px;
  color: #30333b;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.category-trigger svg {
  width: 18px;
  height: 18px;
}

.sort-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #6d7077;
}

.sort-select,
.woocommerce-ordering select {
  min-height: 44px;
  max-width: 210px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  color: #33363d;
  background: #fff;
  font-size: 13px;
}

.reset-filter {
  padding: 10px 0;
  font-size: 12px;
  font-weight: 650;
  color: #c6391e;
  white-space: nowrap;
}

.active-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 12px;
  color: #6c6c71;
}

.active-filter a {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: 4px;
  border: 1px solid #ffcfbf;
  border-radius: 50%;
  color: #c6391e;
  background: #fff;
  font-size: 18px;
}

/* ==========================================================================
   PRODUCT GRID & CARDS — Khóa chuẩn 1 kích thước đồng nhất, chống lệch 100%
   ========================================================================== */
.product-grid,
.woocommerce ul.products,
.woocommerce-page ul.products,
.woocommerce ul.products[class*="columns-"],
.woocommerce-page ul.products[class*="columns-"] {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 14px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  clear: both !important;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after {
  display: none !important;
}

/* Ghi đè triệt để float/width:16.9% của woocommerce-layout.css */
.product-card,
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.woocommerce ul.products[class*="columns-"] li.product,
.woocommerce-page ul.products[class*="columns-"] li.product {
  position: relative !important;
  float: none !important;
  clear: none !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--lka-line) !important;
  border-radius: 10px !important;
  background: #fff !important;
  box-shadow: 0 2px 6px rgba(20, 30, 40, 0.04) !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease !important;
}

.product-card:hover,
.woocommerce ul.products li.product:hover,
.woocommerce-page ul.products li.product:hover {
  border-color: #f5b9ab !important;
  box-shadow: 0 8px 20px rgba(238, 77, 45, 0.12) !important;
  transform: translateY(-2px) !important;
}

/* Khung ảnh sản phẩm luôn vuông 1:1 chuẩn xác */
.product-card > .product-image {
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.woocommerce ul.products li.product .woocommerce-loop-product__link,
.woocommerce-page ul.products li.product .woocommerce-loop-product__link {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  text-decoration: none !important;
}

.woocommerce ul.products li.product a img,
.woocommerce-page ul.products li.product a img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  margin: 0 0 10px 0 !important;
  padding: 0 !important;
  object-fit: cover !important;
  object-position: center !important;
  background: #f6f7f8 !important;
  border-bottom: 1px solid #f1f3f5 !important;
}

/* Nhãn giảm giá / Ưu đãi ở góc trên phải */
.badge,
.woocommerce span.onsale,
.woocommerce ul.products li.product .onsale {
  position: absolute !important;
  z-index: 3 !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 4px 9px !important;
  border-radius: 0 9px 0 9px !important;
  color: var(--lka-brand) !important;
  background: #ffd424 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
}

/* Vùng thông tin bên dưới ảnh: căn lề, độ cao các hàng đồng nhất */
.product-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 12px;
}

.woocommerce ul.products li.product .product-meta,
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product .price,
.woocommerce ul.products li.product .product-sale,
.woocommerce ul.products li.product .card-actions {
  padding-inline: 12px !important;
  margin-inline: 0 !important;
}

/* Hàng 1: Danh mục · SKU (1 dòng cố định) */
.product-meta,
.woocommerce ul.products li.product .product-meta {
  display: block !important;
  height: 16px !important;
  line-height: 16px !important;
  margin: 0 0 4px 0 !important;
  color: #7a8591 !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.2px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Hàng 2: Tên sản phẩm (Cố định đúng 2 dòng = 40px để không bao giờ đẩy lệch giá) */
.product-card h3,
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2.woocommerce-loop-product__title {
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  margin: 0 0 8px 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  display: -webkit-box !important;
  overflow: hidden !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  color: #1e293b !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 20px !important;
}

/* Hàng 3: Khung giá tiền (Cố định chiều cao 40px để cả sản phẩm có giá gạch ngang, giá khoảng hay giá đơn đều thẳng hàng) */
.price,
.woocommerce ul.products li.product .price {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  min-height: 40px !important;
  margin: auto 0 0 0 !important;
  color: var(--lka-brand) !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.old-price,
.woocommerce ul.products li.product .price del {
  display: block !important;
  order: -1 !important;
  margin: 0 0 2px 0 !important;
  color: #94a3b8 !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  text-decoration: line-through !important;
  opacity: 1 !important;
}

.woocommerce ul.products li.product .price ins {
  display: block !important;
  text-decoration: none !important;
  font-weight: 800 !important;
  background: transparent !important;
}

/* Hàng 4: Tiết kiệm / Đã bán (1 dòng 18px cố định) */
.product-sale,
.woocommerce ul.products li.product .product-sale {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  height: 18px !important;
  margin-top: 8px !important;
  color: #64748b !important;
  font-size: 11px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
}

.product-sale span:first-child {
  color: var(--lka-brand) !important;
  font-weight: 500 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.product-sale span:last-child {
  flex-shrink: 0 !important;
}

/* Hàng 5: Nút hành động dưới đáy (Full-width 100%, cao đúng 38px, chữ 1 dòng) */
.card-actions,
.woocommerce ul.products li.product .card-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  margin-top: 10px !important;
  padding-top: 0 !important;
  padding-bottom: 12px !important;
}

.product-info .card-actions {
  padding-bottom: 0 !important;
}

.card-actions .button,
.woocommerce ul.products li.product .card-actions .button,
.woocommerce ul.products li.product .button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 38px !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 6px !important;
  color: #fff !important;
  background: var(--lka-brand) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-align: center !important;
}

.card-actions .button:hover,
.woocommerce ul.products li.product .card-actions .button:hover,
.woocommerce ul.products li.product .button:hover {
  color: #fff !important;
  background: var(--lka-brand-dark) !important;
}

.card-actions .link-arrow {
  display: none !important;
}

/* Ẩn nút "View cart" tự phát sinh của WooCommerce làm vỡ khung thẻ */
.woocommerce ul.products li.product a.added_to_cart {
  display: none !important;
}

/* Category Dialog */
.category-dialog {
  width: min(460px, calc(100% - 24px));
  max-height: 86dvh;
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: #252b33;
  background: #fff;
  box-shadow: 0 20px 70px #0003;
  overscroll-behavior: contain;
}

.category-dialog::backdrop {
  background: rgba(21, 24, 32, 0.45);
  backdrop-filter: blur(3px);
}

.category-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 20px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.category-dialog-head h2 {
  margin: 0;
  font-size: 20px;
}

.category-dialog-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: #737780;
}

.category-dialog-head button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #424750;
  background: #f3f4f6;
  font-size: 27px;
  cursor: pointer;
}

#category-dialog-content {
  padding: 12px 18px 24px;
}

.category-all {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  color: #d33e20;
  background: #fff0ea;
  font-size: 15px;
  font-weight: 650;
}

.category-all span {
  flex: 1;
}

.category-all small {
  display: block;
  margin-top: 3px;
  color: #975947;
  font-size: 11px;
  font-weight: 400;
}

.category-group h3 {
  margin: 22px 0 8px;
  font-size: 12px;
  color: #7b8088;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.category-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  border-bottom: 1px solid #f1f2f4;
}

.category-option strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.category-option small {
  display: block;
  margin-top: 2px;
  color: #737780;
  font-size: 11px;
}

.category-total {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 6px;
  color: #80848b;
  background: #f4f5f6;
  font-size: 12px;
}

.category-option b {
  color: #aaa;
  font-size: 20px;
  font-weight: 400;
}

.category-option:hover {
  background: #fff8f5;
}

/* Mobile Bottom Nav */
.mobile-nav {
  display: none;
}

@media (max-width: 1100px) {
  .product-grid,
  .woocommerce ul.products,
  .woocommerce-page ul.products,
  .woocommerce ul.products[class*="columns-"],
  .woocommerce-page ul.products[class*="columns-"] {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 980px) {
  .quick-categories {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }
  :is(.lka-topbar, .topbar) {
    display: none;
  }
  :is(.lka-site-header, .site-header) {
    position: sticky;
    top: 0;
    box-shadow: 0 2px 8px #39231d10;
  }
  :is(.lka-header-row, .header-row) {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 0;
    padding-top: 12px;
  }
  :is(.lka-logo, .logo) {
    gap: 8px;
    min-width: 0;
  }
  :is(.lka-logo-mark, .logo-mark) {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    flex-shrink: 0;
  }
  :is(.lka-logo-mark, .logo-mark) svg {
    width: 25px;
    height: 25px;
  }
  :is(.lka-logo-copy, .logo-copy) strong {
    font-size: 16px;
    letter-spacing: -0.4px;
  }
  :is(.lka-logo-copy, .logo-copy) small {
    margin-top: 4px;
    font-size: 8px;
  }
  :is(.lka-header-actions, .header-actions) {
    gap: 4px;
  }
  :is(.lka-account, .account, .lka-menu-toggle, .menu-toggle) {
    display: none;
  }
  :is(.lka-cart-link, .cart-link) {
    width: 36px;
    height: 36px;
    margin-right: 5px;
    border-radius: 9px;
    box-shadow: none;
  }
  :is(.lka-cart-icon, .cart-icon) {
    width: 23px;
    height: 23px;
  }
  :is(.lka-cart-link, .cart-link) :is(.lka-cart-count, .cart-count) {
    top: -7px;
    right: -7px;
    min-width: 19px;
    height: 19px;
    font-size: 9px;
    line-height: 15px;
  }
  :is(.lka-search, form.search) {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 44px;
    margin: 0 0 12px;
    padding-left: 12px;
    border-radius: 8px;
    box-shadow: none;
  }
  :is(.lka-search, form.search) input {
    min-width: 0;
    font-size: 16px;
  }
  :is(.lka-search, form.search) button {
    min-width: 44px;
    width: 44px;
    padding: 0;
    border-radius: 5px;
  }
  :is(.lka-search, form.search) button span {
    display: none;
  }
  :is(.lka-primary-nav, .primary-nav) {
    display: none;
  }
  :is(.lka-container, .container) {
    width: calc(100% - 24px);
  }
  .catalog-page {
    padding: 12px 0 28px;
  }
  .catalog-categories {
    padding: 14px 10px 10px;
    margin-bottom: 16px;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 2px 6px #24283004;
  }
  .catalog-section-head {
    gap: 6px;
    padding-inline: 4px;
  }
  .catalog-eyebrow {
    font-size: 8px;
    letter-spacing: 0.8px;
  }
  .catalog-section-head h2 {
    font-size: 18px;
  }
  .text-button {
    font-size: 11px;
    padding: 8px 0;
  }
  .quick-categories {
    gap: 5px 0;
    margin-top: 10px;
  }
  .quick-category {
    gap: 7px;
    padding: 8px 2px;
    font-size: 11px;
    min-height: 86px;
  }
  .quick-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }
  .quick-icon svg {
    width: 23px;
    height: 23px;
  }
  .catalog-sticky-bar {
    padding-top: 10px;
    margin-bottom: 12px;
  }
  .catalog-sticky-bar :is(.catalog-title-row, .catalog-heading, .woocommerce-products-header) h1 {
    font-size: 20px;
    line-height: 1.45;
    letter-spacing: -0.2px;
  }
  .catalog-title-row p {
    font-size: 11px;
  }
  .catalog-tag {
    display: none;
  }
  .catalog-tools {
    margin: 10px 0 0;
  }
  .sort-label > span {
    display: none;
  }
  .sort-select,
  .woocommerce-ordering select {
    width: 164px;
    padding-left: 10px;
    font-size: 12px;
  }
  .product-grid,
  .woocommerce ul.products,
  .woocommerce-page ul.products,
  .woocommerce ul.products[class*="columns-"],
  .woocommerce-page ul.products[class*="columns-"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .product-info {
    padding: 10px;
  }
  .woocommerce ul.products li.product .product-meta,
  .woocommerce ul.products li.product .woocommerce-loop-product__title,
  .woocommerce ul.products li.product .price,
  .woocommerce ul.products li.product .product-sale,
  .woocommerce ul.products li.product .card-actions {
    padding-inline: 10px !important;
  }
  .product-meta,
  .woocommerce ul.products li.product .product-meta {
    font-size: 9px !important;
  }
  .product-card h3,
  .woocommerce ul.products li.product .woocommerce-loop-product__title {
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    font-size: 12px !important;
    line-height: 18px !important;
  }
  .price,
  .woocommerce ul.products li.product .price {
    min-height: 36px !important;
    font-size: 14px !important;
  }
  .old-price,
  .woocommerce ul.products li.product .price del {
    font-size: 10px !important;
  }
  .product-sale,
  .woocommerce ul.products li.product .product-sale {
    display: none !important;
  }
  .card-actions .button,
  .woocommerce ul.products li.product .card-actions .button,
  .woocommerce ul.products li.product .button {
    height: 36px !important;
    min-height: 36px !important;
    font-size: 12px !important;
  }
  .badge,
  .woocommerce span.onsale,
  .woocommerce ul.products li.product .onsale {
    padding: 3px 7px !important;
    font-size: 9px !important;
  }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    z-index: 60;
    inset: auto 0 0;
    min-height: 64px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid #eceef0;
    background: #fff;
    box-shadow: 0 -3px 16px #1c283208;
  }
  .mobile-nav > a,
  .mobile-nav > button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 50px;
    padding: 3px;
    border: 0;
    background: none;
    color: #747983;
    font-size: 10px;
    font-weight: 550;
    cursor: pointer;
  }
  .mobile-nav [aria-current="page"],
  .mobile-nav a.active {
    color: #e44728;
    font-weight: 700;
  }
  .mobile-nav svg {
    width: 22px;
    height: 22px;
  }
  .mobile-bag {
    position: relative;
    display: flex;
  }
  .mobile-bag b {
    position: absolute;
    top: -6px;
    left: 15px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border: 2px solid #fff;
    border-radius: 12px;
    background: var(--lka-brand);
    color: #fff;
    font-size: 9px;
    line-height: 13px;
  }
  .category-dialog {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: 88dvh;
    margin: 0;
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
  }
}
