/* ====== GRID CONTAINER ====== */
.tnl-products-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  justify-items: center;
  padding: 10px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .tnl-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
}

@media (min-width: 1024px) {
  .tnl-products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ====== PRODUCT CARD ====== */
.product-ca {
  --accent-color: #ffd426;
  position: relative;
  width: 100%;
  max-width: 250px;
  background: white;
  border-radius: 1rem;
  padding: 0.5rem;
  box-shadow: rgba(100, 100, 111, 0.15) 0px 15px 25px -10px;
  transition: all 0.4s ease-in-out;
  
  
}

/* ✅ KHUNG ẢNH HÌNH VUÔNG, TỰ CO THEO RỘNG */
.product-ca .image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 0.7rem;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.product-ca .image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* PRICE TAG */
.product-ca .image-container .price {
  position: absolute;
  right: -3px;   /* sang phải */
  bottom: -3px; 
  background: rgba(255,255,255,255);
  color: var(--accent-color);
  font-weight: 900;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  border-radius: 0.8rem 0 0 0; /* 👈 góc trên trái bo nhẹ */
  box-shadow: 0 -2px 6px rgba(0,0,0,0.1);
  z-index: 2;
  transform: translate(1px,1px); /* 👈 đẩy nhẹ để “né” viền bo */
}

/* FAVORITE ICON */
.product-ca .favorite {
  position: absolute;
  width: 1.5rem;
  height: 1.5rem;
  top: 6px;
  right: 6px;
  cursor: pointer;
  border-radius:0.6rem;
  background: rgba(255,255,255,255);
}

.product-ca .favorite input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.product-ca .favorite input:checked ~ svg {
  animation: bouncing 0.5s;
  fill: rgb(255, 95, 95);
  filter: drop-shadow(0px 3px 1px rgba(53, 53, 53, 0.14));
}

.product-ca .favorite svg {
  fill: #a8a8a8;
  transition: fill 0.3s ease;
}

/* ✅ GIẢM KHOẢNG CÁCH GIỮA BRAND & TITLE */
.product-ca .content {
  padding: 0 0.8rem;
  margin-bottom: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}




.product-ca .content .brand {
  font-weight: 700;
  color: #a6a6a6;
  font-size: 0.8rem;
  line-height: 1.2;
}


.product-ca .content .product-name {
  font-weight: 800;
  color: #444;
  font-size: 1rem;
  margin: 0;
  line-height: 1.3;

  /* 🪄 Giới hạn tối đa 2 dòng, tự thêm “...” nếu quá dài */
  display: -webkit-box;
  -webkit-line-clamp: 2; /* 👈 số dòng tối đa */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  min-height: 40px;
}

/* RATING */
.product-ca .content .rating {
  color: #a8a8a8;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1px;
}

/* 🎯 FIX NÚT CĂN GIỮA TUYỆT ĐỐI */
.product-ca .button-container {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  padding: 0.6rem 0 0.8rem !important;
  text-align: center !important;
  flex-direction: column;
}

.product-ca .button-container > * {
  margin: 0 auto !important;
  float: none !important;
  text-align: center !important;
}

/* NÚT ĐẸP GỌN */
.button-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  background-color: transparent;
  
  border: none;
  border-radius: 12px;
  outline: 2px solid #181717;
  outline-offset: -2px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 150px;
  text-align: center;
  margin: 0 auto !important;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.button-cart .text {
  
  color: #181717;
  font-weight: 700;
  font-size: 0.85em;
  line-height: 1;
  margin: 0;
}

.button-cart svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  position: relative;
  top: 0.5px;
}

.button-cart svg path {
  
  fill: #181717;
  transition: fill 0.3s ease;
}

.button-cart:hover {
  background-color: #181717;
  transform: translateX(-50%) scale(1.03);
}

.button-cart:hover .text {
  color: #fff;
}

.button-cart:hover svg path {
  fill: #fff;
}

.button-cart.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.button-cart.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid #181717;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  right: 12px;
}

.button-cart.loading::after {
  border: 2px solid #181717;
  border-top-color: transparent;
}

/* ✅ Khi thêm thành công */
.button-cart.added {
  background-color: #00b493 !important; /* xanh lá nhẹ */
  color: #181717 !important;
  outline-color: #00b493 !important;
}

.button-cart.added .text {
  color: #181717 !important; /* 👈 Đen */
}

.button-cart.added svg path {
  fill: #181717 !important;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* TOAST */
#tnl-toast {
  position: fixed;
  top: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: #00b493;
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 600;
  z-index: 9999;
  display: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  max-width: 300px;
  text-align: center;
  word-wrap: break-word;
  animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
  from { transform: translate(-50%, -30px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes bouncing {
  from, to { transform: scale(1, 1); }
  25% { transform: scale(1.5, 2.1); }
  50% { transform: scale(2.1, 1.5); }
  75% { transform: scale(1.5, 2.05); }
}

.product-ca:hover {
  transform: scale(1.03);
}

.image-link img {
  transition: transform 0.3s ease;
}

.image-link:hover img {
  transform: scale(1.05);
}

.product-name {
  color: #333;
  font-weight: 800;
  text-decoration: none;
  display: block;
  line-height: 1.3;
  font-size: 1rem;
}

.product-name:hover {
  color: #000;
  text-decoration: underline;
}


.tnl-contact-form-container {
  max-width: 350px;
  background: #F8F9FD;
  background: linear-gradient(0deg, rgb(255, 255, 255) 0%, rgb(244, 247, 251) 100%);
  border-radius: 40px;
  padding-top: 25px;
  padding-bottom: 25px;
  padding-left: 20px;
  padding-right: 45px;
  border: 5px solid rgb(255, 255, 255);
  box-shadow: rgba(133, 189, 215, 0.8784313725) 0px 30px 30px -20px;
}

.tnl-contact-form-heading {
  text-align: center;
  font-weight: 900;
  font-size: 30px;
  color: rgb(16, 137, 211);
}

.tnl-contact-form {
  margin-top: 20px;
}

.tnl-contact-form .tnl-contact-form-input {
  width: 100%;
  background: white;
  border: none;
  padding: 15px 10px;
  border-radius: 20px;
  margin-top: 15px;
  box-shadow: #cff0ff 0px 10px 10px -5px;
  border-inline: 2px solid transparent;
}

.tnl-contact-form .tnl-contact-form-input::-moz-placeholder {
  color: rgb(170, 170, 170);
}

.tnl-contact-form .tnl-contact-form-input::placeholder {
  color: rgb(170, 170, 170);
}

.tnl-contact-form .tnl-contact-form-input:focus {
  outline: none;
  border-inline: 2px solid #12B1D1;
}

.tnl-contact-form .tnl-contact-form-submit-button {
  display: block;
  width: 100%;
  font-weight: bold;
  background: linear-gradient(45deg, rgb(16, 137, 211) 0%, rgb(18, 177, 209) 100%);
  color: white;
  padding-block: 15px;
  margin: 20px auto;
  border-radius: 20px;
  box-shadow: rgba(133, 189, 215, 0.8784313725) 0px 20px 10px -15px;
  border: none;
  transition: all 0.2s ease-in-out;
}

.tnl-contact-form .tnl-contact-form-submit-button:hover {
  transform: scale(1.03);
  box-shadow: rgba(133, 189, 215, 0.8784313725) 0px 23px 10px -20px;
}

.tnl-contact-form .tnl-contact-form-submit-button:active {
  transform: scale(0.95);
  box-shadow: rgba(133, 189, 215, 0.8784313725) 0px 15px 10px -10px;
}



/* ✅ Pagination fix - luôn giữa và luôn dưới */
.woocommerce-pagination {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 40px;
  margin-bottom: 40px;
  clear: both;
}

/* Giữ pagination không dính lên grid */
.tnl-products-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tnl-products-grid {
  width: 100%;
  margin-bottom: 30px;
}

/* ✅ Căn giữa danh sách trang */
.woocommerce-pagination ul.page-numbers {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ✅ Style pagination đẹp hơn */
.woocommerce-pagination a,
.woocommerce-pagination span {
  display: inline-block;
  margin: 0 10px;             /* tăng khoảng cách giữa các nút */
  padding: 8px 16px;          /* nút to hơn nhẹ */
  background: #f4f4f4;
  border-radius: 8px;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
  min-width: 36px;            /* các nút đều nhau */
  text-align: center;
}

.woocommerce-pagination a:hover,
.woocommerce-pagination .current {
  background: #0C7484;
  color: #fff;
}


/* 🌿 Container: holds both grid + pagination */
#tnl_filter_results {
  display: flex;
  flex-direction: column;
  min-height: 500px; /* keeps layout stable even with few products */
}

/* 🌿 Product grid */
#tnl_filter_results .tnl-products-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  justify-content: center;
  align-items: stretch;
  margin-bottom: 40px;
}

/* 🌿 Product card */
#tnl_filter_results .product-ca {
  width: 100%;
  box-sizing: border-box;
}

/* 🌿 Pagination stays pinned below grid */
#tnl_filter_results .woocommerce-pagination {
  align-self: center;
  margin-top: 20px;
  margin-bottom: 20px;
}


#tnl_filter_results .tnl-products-grid {
  transition: all 0.2s ease;
  min-height: 400px; /* keeps space reserved while loading */
}

.tnl-products-grid,
#tnl_filter_results .tnl-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  justify-content: center;
  max-width: 1200px;       /* 👈 giữ đồng nhất chiều rộng giữa filter và store */
  margin: 0 auto !important;
  transition: all 0.2s ease;
}

/* đảm bảo pagination luôn cách đều và căn giữa */
.woocommerce-pagination {
  display: flex;
  justify-content: center;
  margin-top: 40px;
  margin-bottom: 20px;
}

/* 📦 Wrapper luôn cố định giữa */
.tnl-products-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* 🧱 Grid container - giữ sản phẩm luôn giữa */
.tnl-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 1200px;
  justify-items: center; /* 👈 Căn giữa từng item */
  justify-content: center; /* 👈 Giữ toàn grid giữa khung */
  margin: 0 auto;
  transition: all 0.2s ease;
}

/* 🪄 Đảm bảo mỗi product card đều có width ổn định */
.product-ca {
  width: 100%;
  max-width: 250px;
  box-sizing: border-box;
}

/* 🔽 Pagination căn giữa cố định */
.woocommerce-pagination {
  display: flex;
  justify-content: center;
  margin-top: 40px;
  margin-bottom: 40px;
}

.tnl-products-grid {
  opacity: 1;
  transition: opacity 0.3s ease;
}
.tnl-products-grid.loading {
  opacity: 0.3;
}

.tnl-products-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  justify-content: center;
  align-items: start;
  width: 100%;
  margin: 0 auto;
  transition: opacity 0.3s ease;
}

.tnl-products-grid.loading {
  opacity: 0.3;
}


#tnl_filter_results,
.tnl-products-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.tnl-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  justify-content: center;
  align-items: start;
  transition: opacity 0.3s ease;
}

.tnl-products-grid.loading {
  opacity: 0.4;
}

.woocommerce-pagination {
  margin-top: 40px;
  text-align: center;
}

/* 🔥 FIX: đảm bảo grid không sụp dọc khi đổi trang */
.tnl-products-grid,
#tnl_filter_results .tnl-products-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
  gap: 24px !important;
  justify-content: center !important;
  align-items: start !important;
  width: 100% !important;
}

.tnl-products-grid .product-ca {
  width: 100% !important;
  box-sizing: border-box;
}


/**/

.tnl-swiper {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  position: relative;
  padding: 10px 0;
}

.tnl-swiper-wrapper {
  display: flex;
  transition: transform 0.4s ease;
  gap: 20px;
}

.tnl-swiper-slide {
  flex: 0 0 250px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  overflow: hidden;
  transition: all 0.3s ease;
}

.tnl-swiper-slide:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.tnl-swiper-slide img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.tnl-swiper-prev,
.tnl-swiper-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #00796b;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 22px;
  z-index: 10;
}

.tnl-swiper-prev:hover,
.tnl-swiper-next:hover {
  background: #004d40;
}

.tnl-swiper-prev { left: 0; }
.tnl-swiper-next { right: 0; }


/* ✅ FIX: luôn hiển thị 2 sản phẩm / hàng trên mobile */
@media (max-width: 768px) {
  .tnl-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }
}

/* ✅ FIX: carousel không phóng to 1 sp */
.tnl-category-swiper .swiper-slide {
  width: auto !important;
  max-width: 50% !important; /* mỗi slide chiếm 50% khung trên mobile */
}

/* Xóa gạch chân cho tất cả link trong plugin TNL Design */
.tnl-products-wrapper a,
.woocommerce-pagination a {
  text-decoration: none !important;
}

/* Khi hover có thể thêm màu nếu muốn */
.tnl-products-wrapper a:hover,
.woocommerce-pagination a:hover {
  text-decoration: none !important;
  color: #0C7484; /* hoặc giữ nguyên màu bạn thích */
}

/* 🔧 Fix underline gọn nhẹ cho Category Carousel */
.tnl-category-swiper a,
.tnl-category-swiper a * {
  text-decoration: none !important;
  border-bottom: none !important;
}


.tnl-category-swiper a:hover,
.tnl-category-swiper a:hover * {
  text-decoration: none !important;
  color: #0C7484 !important;
}


.tnl-infor-policy {
    background: #f8f8f8;
    padding: 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tnl-infor-policy .icon-box {
    display: flex;
    align-items: center;
    gap: 10px;
}
.tnl-infor-policy .icon img {
    width: 22px;
    height: 22px;
}
.tnl-infor-policy .text {
    font-size: 14px;
    color: #333;
}

