/* products.css */
.products-toolbar {
  max-width: 1200px;
  
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(139, 30, 20, 0.12);
  padding: 10px 20px;      /* ← có padding ngang 20px để khớp container nội dung */
  margin: 50px 0;
  background-color: #fff;
  box-sizing: border-box;
}


/* Cụm trái (Filter + Featured) */
.toolbar-left {
  display: flex;
  gap: 10px;
}

.toolbar-btn {
  border: 1px solid rgba(139, 30, 20, 0.2);
  background: none;
  color: #8b1e14;
  font-family: "Playfair Display", serif;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: 0.3s;
}

.toolbar-btn:hover {
  background-color: rgba(139, 30, 20, 0.05);
}

/* Cụm phải (3 icon layout) */
.toolbar-right {
  display: flex;
  gap: 14px;
}

.layout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #8b1e14;
  font-size: 16px;
  opacity: 0.6;
  transition: opacity 0.3s, color 0.3s;
}

.layout-btn.active,
.layout-btn:hover {
  opacity: 1;
  color: #8b1e14;
}



.filters-panel {
  /* --- VỊ TRÍ & KÍCH THƯỚC --- */
  position: absolute; /* Quan trọng nhất: Lấy ra khỏi luồng */
  
  /* Căn lề trên khớp với .product-gallery (lề 40px) 
     sau khi .products-toolbar (lề 50px + cao ~60px) kết thúc */
  top: calc(50px + 60px + 40px - 40px); /* ~150px - Điều chỉnh nếu toolbar cao/thấp hơn */
  left: 0;
  width: 250px;     /* Độ rộng sidebar (phải nhỏ hơn 260px ở .shrink) */
  box-sizing: border-box; 
  
  /* --- TRẠNG THÁI ẨN --- */
  opacity: 0;
  transform: translateX(-20px); /* Hiệu ứng trượt nhẹ từ trái */
  visibility: hidden;           /* Ẩn hoàn toàn */
  
  /* --- HIỆU ỨNG --- */
  transition: transform 0.35s ease, opacity 0.35s ease, visibility 0.35s ease;

  /* --- STYLE CŨ GIỮ LẠI --- */
  padding: 20px; /* Luôn có padding, không cần cho vào .visible */
  border: 1px solid rgba(139, 30, 20, 0.12);
  background-color: #fff;
  color: #8b1e14;
  font-family: "Playfair Display", serif;
  margin-top: 0; /* Ghi đè margin-top: 20px cũ */


}

.filters-panel.visible {
  opacity: 1;
  transform: translateX(0); /* Trượt vào vị trí */
  visibility: visible;
  /* Xóa bỏ hoàn toàn max-height: 500px và padding: 20px cũ */
}


.filters-panel h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-list {
  list-style: none;
  padding-left: 0;
}

.filter-list li {
  margin: 6px 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.filter-list li input[type="checkbox"] {
  accent-color: #8b1e14;
  transform: scale(1.1);
}

.filter-list .show-more {
  margin-top: 8px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Hiệu ứng trượt mượt */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mặc định ẩn các mục này đi */
.hidden-item {
  display: none;
}

/* Style cho nút Show More để người dùng biết là bấm được */
.show-more {
  font-weight: 700;
  cursor: pointer;
  color: #8b1e14;
  margin-top: 10px;
}
.show-more:hover {
  text-decoration: underline;
}



/* FEATURED DROPDOWN */
.sort-dropdown {
  position: relative;
  display: inline-block;
}

.sort-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #fff;
  border: 1px solid rgba(139, 30, 20, 0.15);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  list-style: none;
  margin: 0;
  padding: 8px 0;
  display: none; /* ẩn mặc định */
  z-index: 1000;
  width: 200px;
}

.sort-menu li {
  padding: 8px 16px;
  color: #8b1e14;
  font-family: "Playfair Display", serif;
  font-size: 14px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s;
}

.sort-menu li:hover {
  background-color: rgba(139, 30, 20, 0.05);
}

/* Khi mở menu */
.sort-dropdown.active .sort-menu {
  display: block;
}




/* img */
.product-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  margin: 40px 0;
  justify-items: stretch;
  max-width: 1200px;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.35s ease;
}


/* Khi có class layout-2 thì chuyển thành 2 cột */
.product-gallery.layout-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* Tùy chỉnh: Khi ảnh to ra (2 cột), có thể bạn muốn tăng chiều cao ảnh lên chút cho đẹp */
.product-gallery.layout-2 .image-wrapper {
  height: 450px; /* Tăng chiều cao ảnh khi ở chế độ xem lớn */
}

.product-gallery.layout-4 {
  grid-template-columns: repeat(4, 1fr); /* Chia 4 cột */
  gap: 20px; /* Giảm khoảng cách chút cho đỡ thưa */
}

/* Khi ảnh nhỏ (4 cột), giảm chiều cao ảnh xuống cho cân đối */
.product-gallery.layout-4 .image-wrapper {
  height: 280px; 
}

.product {
  position: relative;
  text-align: center;
  overflow: hidden;
  background-color: #fff;
  border-radius: 10px;
}

.product img {
  width: 100%;
  height: 350px;
  object-fit: cover; /* giúp các ảnh có cùng kích thước */
  transition: opacity 0.8s ease;
  border-radius: 10px;
  display: block;
}

.product img.hover {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

.product:hover img.hover {
  opacity: 1;
}

.product:hover img.main {
  opacity: 0;
}

.product .title {
  font-size: 18px;
  color: #833b1a;
  margin-top: 10px;
  font-weight: 600;
}

.product .price {
  font-size: 16px;
  color: #c47a3f;
  margin-top: 4px;
}




/* =========================
   HIỆU ỨNG HOVER: THANH TRẮNG & ĐỔI ẢNH
   ========================= */
.image-wrapper {
  position: relative;
  width: 100%;
  height: 350px;
  overflow: hidden;
  border-radius: 10px;
}

.image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
  border-radius: 10px;
}

.image-wrapper img.active {
  opacity: 1;
  position: relative;
}


/* --- PROGRESS BAR KIỂU STORY --- */

/* Hộp chứa chung: Nằm trên cùng, chia cột flex */
.progress-container {
  position: absolute;
  top: 10px;          /* Cách mép trên 10px */
  left: 10px;         /* Cách mép trái 10px */
  right: 10px;        /* Cách mép phải 10px */
  z-index: 20;        /* Nằm trên ảnh và badge */
  display: flex;      /* Xếp các thanh nằm ngang */
  gap: 5px;           /* Khoảng cách giữa các đoạn */
  height: 3px;        /* Chiều cao thanh */
  pointer-events: none; /* Để chuột xuyên qua bấm vào ảnh được */
}

/* Các đoạn nền (màu xám mờ) */
.progress-segment {
  flex: 1;            /* Tự động chia đều chiều rộng */
  background-color: rgba(255, 255, 255, 0.3); /* Màu nền chưa chạy */
  border-radius: 2px;
  overflow: hidden;   /* Để thanh fill bên trong không bị tràn */
  height: 100%;
  position: relative;
}

/* Thanh màu trắng chạy bên trong mỗi đoạn */
.progress-fill {
  background-color: #fff; /* Màu trắng sáng */
  width: 0;
  height: 100%;
  display: block;
}

/* Hiệu ứng chạy từ 0 -> 100% */
@keyframes fillAnimation {
  from { width: 0; }
  to { width: 100%; }
}


/* Khi mở filter → thu nhỏ gallery sang phải */
.product-gallery.shrink {
    margin-left: 260px;      /* đẩy gallery sang phải nhường chỗ cho sidebar */
    width: calc(100% - 260px);
}

/* Sidebar filters hiện lên */
.filters-panel.visible {
    left: 0;                 /* trượt từ bên trái vào */
    opacity: 1;
}



/* --- Đảm bảo .image-wrapper là điểm neo --- */
.image-wrapper {
  position: relative; /* Đã có rồi, nhưng nhắc lại cho chắc */
  overflow: hidden;   /* Để nút trượt từ dưới lên không bị lòi ra ngoài */
}

/* ===========================
   1. BADGE (NEW IN / RE-RELEASE)
   =========================== */
/* Badge (Nhãn góc trên) */
.badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  
  background-color: #fff;
  color: #8b1e14;
  font-family: sans-serif;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 10px;
  text-transform: uppercase;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  
  /* --- THÊM DÒNG NÀY --- */
  transition: opacity 0.3s ease, visibility 0.3s ease; /* Tạo hiệu ứng mờ dần */
}

/* Khi di chuột vào sản phẩm (.product) thì ẩn Badge đi */
.product:hover .badge {
  opacity: 0;          /* Làm mờ hoàn toàn */
  visibility: hidden;  /* Ẩn hẳn khỏi cây hiển thị để không bấm nhầm */
}

/* ===========================
   2. ADD TO CART BUTTON
   =========================== */
.add-to-cart-btn {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 10; /* Nằm đè lên trên ảnh */
  
  background-color: rgba(230, 226, 221, 0.95); /* Màu kem nhạt, hơi trong suốt */
  color: #8b1e14;
  border: none;
  padding: 15px 0;
  
  font-family: "Playfair Display", serif; /* Hoặc font bạn muốn */
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  
  /* Hiệu ứng ẩn mặc định */
  opacity: 0;
  transform: translateY(100%); /* Đẩy nút xuống dưới đáy ảnh */
  transition: all 0.4s ease;
}

.add-to-cart-btn:hover {
  background-color: #8b1e14;
  color: #fff;
}

/* Hiệu ứng rung lắc giỏ hàng */
@keyframes shakeCart {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(15deg); }
  50% { transform: rotate(-15deg); }
  75% { transform: rotate(5deg); }
  100% { transform: rotate(0deg); }
}

.cart-shake i {
  animation: shakeCart 0.4s ease-in-out;
  color: #c47a3f; /* Đổi màu icon một chút khi rung */
}

/* ===========================
   HIỆU ỨNG KHI DI CHUỘT VÀO SẢN PHẨM (.product)
   =========================== */
.product:hover .add-to-cart-btn {
  opacity: 1;
  transform: translateY(0); /* Trượt lên vị trí gốc */
}