/* ==========================================================================
   GIAO DIỆN DANH MỤC SẢN PHẨM (GRID 4 CỘT CHUẨN AP)
   ========================================================================== */

/* 1. Khung chứa tràn viền, chỉ chừa lề nhỏ 2 bên */
.ap-product-archive {
    padding: 150px 0 100px;
    background-color: #ffffff;
}
.ap-container-fluid {
    padding: 180px 40px;
    max-width: 100%;
}

/* 2. Thanh Search & Filter phía trên (Chuẩn AP có kính lúp) */
.ap-shop-header {
    margin-bottom: 80px;
}
.search-bar-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eaeaea; /* Vạch kẻ ngang dời lên ngay dưới thanh Search */
    padding-bottom: 30px;
    margin-bottom: 25px; /* Tạo khoảng cách với hàng Filters ở dưới */
}
/* Biến thẻ Input thành dòng text sang trọng */
.shop-search-input {
    width: 100%;
    font-size: 3.5rem;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 100; /* Nét siêu mỏng */
    color: #111; /* Màu đen khi gõ chữ */
    background: transparent;
    border: none;
    outline: none !important;
    box-shadow: none !important;
    padding: 0;
    margin: 0;
    letter-spacing: 1px;
}
.shop-search-input::placeholder {
    color: #ccc; /* Màu xám nhạt cho chữ Search for watches... */
}

/* Biến nút Submit thành Icon bấm được */
.search-bar-wrapper button.search-icon-right {
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 0;
    outline: none;
    transition: color 0.3s;
}
.search-bar-wrapper button.search-icon-right:hover {
    color: #000;
}
.search-icon-right {
    color: #555;
    cursor: pointer;
}
.shop-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #111;
}
.filter-btn { display: flex; align-items: center; gap: 8px; cursor: pointer; transition: color 0.3s; }
.filter-btn:hover, .compare-btn:hover { color: #666; cursor: pointer;}

/* Khoảng cách thở giữa các khối Danh mục (Vd: Royal Oak cách xa Code 11.59) */
.product-category-section {
    margin-bottom: 120px;
}
/* 3. Tiêu đề Danh mục (Ví dụ: ROYAL OAK) */
.category-title {
    font-size: 2rem;
    font-weight: 200; /* Nét mỏng */
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 40px;
}

/* 4. Lưới Sản phẩm 4 Cột */
.product-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px; /* Khoảng cách giữa các cột rất hẹp */
}

/* ==========================================================================
   5. KHỐI SẢN PHẨM & HIỆU ỨNG ĐỔI ẢNH PHỤ (IMAGE SWAP ON HOVER)
   ========================================================================== */
.product-item {
    background-color: #f8f8f8; /* Nền xám siêu nhạt cho sang */
    text-align: center;
    transition: background-color 0.3s ease;
}
.product-link {
    display: block;
    text-decoration: none;
    color: #111;
}

/* Khung chứa ảnh: Cố định tỷ lệ để ảnh không bị nhảy */
.product-thumb {
    position: relative;
    padding: 50px 50px 0; /* Cách lề trên và 2 bên */
    aspect-ratio: 1/1.1; /* Tỷ lệ khung ảnh */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Setup chung cho cả Ảnh Chính và Ảnh Phụ */
.img-primary, .img-secondary {
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply; /* Xóa phông nền trắng */
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Đặt vị trí tuyệt đối cho ảnh phụ để nó đè lên cùng 1 vị trí */
.img-secondary {
    position: absolute;
    top: 50px;
    left: 50px;
    width: calc(100% - 100px);
}

/* ==========================================================================
   LOGIC ĐẢO NGƯỢC: ẢNH PHỤ LÀM MẶC ĐỊNH, ẢNH CHÍNH ĐỂ HOVER
   ========================================================================== */

/* --- TRƯỜNG HỢP 1: CÓ ẢNH PHỤ --- */
/* Mặc định: Ẩn ảnh chính, Hiện ảnh phụ */
.product-thumb.has-sec-img .img-primary {
    opacity: 0; 
    transform: scale(0.95); /* Hơi thu nhỏ sẵn chờ hover */
}
.product-thumb.has-sec-img .img-secondary {
    opacity: 1; 
    transform: scale(1);
}

/* Hover: Hiện ảnh chính lên, Ẩn ảnh phụ đi */
.product-item:hover .product-thumb.has-sec-img .img-primary {
    opacity: 1;
    transform: scale(1.05); /* Zoom to ảnh chính lên một chút */
}
.product-item:hover .product-thumb.has-sec-img .img-secondary {
    opacity: 0;
    transform: scale(0.95); /* Thu nhỏ và chìm ảnh phụ đi */
}

/* --- TRƯỜNG HỢP 2: KHÔNG CÓ ẢNH PHỤ (PHÒNG HỜ) --- */
/* Nếu quên up ảnh phụ, ảnh chính vẫn hiện bình thường để không bị lỗi khoảng trắng */
.product-thumb:not(.has-sec-img) .img-primary {
    opacity: 1;
}
.product-item:hover .product-thumb:not(.has-sec-img) .img-primary {
    transform: scale(1.05); /* Vẫn có hiệu ứng zoom nhẹ cho đẹp */
}

/* 6. Khu vực Text Thông tin nằm cố định bên dưới (Giống ảnh mẫu) */
.product-info-bottom {
    padding: 25px 30px 40px;
}
.product-info-bottom .sku {
    font-size: 11px;
    color: #999;
    margin-bottom: 15px;
    letter-spacing: 1px;
}
.product-info-bottom .prod-name {
    font-size: 16px;
    font-weight: 700; /* In đậm chữ */
    color: #111;
    margin-bottom: 8px;
    line-height: 1.4;
}
.product-info-bottom .desc {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    margin: 0;
}

/* Khi Hover thì đổi màu nền xám tối hơn một tí cho rõ khối */
.product-item:hover {
    background-color: #f0f0f0;
}

/* 7. Responsive Mobile */
@media (max-width: 1200px) {
    .product-grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 991px) {
    .product-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .ap-container-fluid { padding: 0 20px; }
    .shop-search-title { font-size: 2rem; }
}
@media (max-width: 576px) {
    .product-grid-4 { grid-template-columns: 1fr; } /* Ép 1 cột trên điện thoại nhỏ */
}

/* ==========================================================================
   BẢNG ĐIỀU KHIỂN BỘ LỌC (FILTER PANEL)
   ========================================================================== */
.ap-filter-panel {
    background: #fafafa;
    border-bottom: 1px solid transparent;
    
    /* THUẬT TOÁN ẨN HÌNH BẰNG CSS */
    max-height: 0; /* Khóa chiều cao bằng 0 */
    overflow: hidden; /* Giấu toàn bộ ruột bên trong khi đóng */
    opacity: 0; /* Làm mờ hẳn */
    padding: 0 50px; /* Tạm thời triệt tiêu padding top/bottom để không lộ khung xám */
    margin-top: -20px;
    margin-bottom: 0;
    
    /* Tạo độ trễ trượt mượt mà cho mọi thuộc tính */
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
                opacity 0.3s ease, 
                padding 0.4s cubic-bezier(0.25, 1, 0.5, 1),
                margin-bottom 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.ap-filter-panel.is-active {
    max-height: 600px; /* Nới rộng trần chiều cao thoải mái để chứa nội dung checkbox */
    opacity: 1; /* Hiện hình rõ nét */
    padding: 40px 50px; /* Trả lại khoảng thở rộng thênh thang */
    margin-bottom: 80px;
    border-bottom: 1px solid #eaeaea;
}
.filter-columns {
    display: flex;
    gap: 80px;
}
.filter-col h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 25px;
    color: #111;
}
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ĐỘ LẠI NÚT CHECKBOX CỰC SANG */
.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 32px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    user-select: none;
    transition: color 0.3s;
}
.custom-checkbox:hover { color: #111; }

/* Ẩn input thật đi */
.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Vẽ ô vuông giả */
.custom-checkbox .checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    border: 1px solid #ccc;
    background-color: transparent;
    transition: all 0.2s;
}

/* Màu viền khi hover và khi được tích */
.custom-checkbox:hover input ~ .checkmark { border-color: #888; }
.custom-checkbox input:checked ~ .checkmark { background-color: #111; border-color: #111; }

/* Vẽ dấu V (Tích) bên trong ô vuông */
.custom-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.custom-checkbox input:checked ~ .checkmark:after { display: block; }
.custom-checkbox input:checked ~ .checkmark + span { color: #111; font-weight: 600; }

/* Các Nút bấm hành động (Apply / Clear) */
.filter-actions {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eaeaea;
    display: flex;
    align-items: center;
    gap: 30px;
}
.btn-apply-filter {
    background: #111;
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: background 0.3s ease;
}
.btn-apply-filter:hover { background: #444; }

.btn-clear-filter {
    color: #888;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    transition: color 0.3s;
}
.btn-clear-filter:hover { color: #111; }