/* ================================================= */
/* 0. BASE & UTILITIES (Dựa trên thiết kế Lumière) */
/* ================================================= */
:root {
    --color-primary: #000;
    --color-secondary: #F9F5EA; /* Light beige/off-white background */
    --color-text: #333;
    --color-light-text: #999;
    --font-serif: "Times New Roman", Times, serif; 
    --font-sans: Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background-color: #F9F5EA;
    line-height: 1.6;
}

h1, h2, h3, h4 {
    font-family: var(--font-serif);
    font-weight: normal;
    text-transform: uppercase;
}

a {
    text-decoration: none;
    color: var(--color-text);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Buttons/Links --- */
.btn {
    padding: 10px 25px;
    text-transform: uppercase;
    font-size: 14px;
    transition: background-color 0.3s;
    cursor: pointer;
    text-align: center;
    border: none;
}

.btn-primary {
    background-color: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-border {
    background-color: transparent;
    border: 1px solid #fff;
    color: #fff;
    padding: 8px 20px;
}

/* ================================================= */
/* 1. HEADER & FOOTER (Cần thiết cho giao diện trang) */
/* ================================================= */

.header-top-bar {
    background-color: var(--color-primary);
    color: #fff;
    text-align: center;
    padding: 5px 0;
    font-size: 12px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background-color: #fff;
    border-bottom: 1px solid #eee;
    position: relative;
}

.logo {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.logo a {
    color: var(--color-text);
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
}

.nav-link {
    margin-right: 25px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-link.active {
    font-weight: bold;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 2px;
}

.nav-right a {
    margin-left: 20px;
}

.nav-right .btn {
    margin-left: 30px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

/* --- Footer --- */
.main-footer {
    background-color: var(--color-primary);
    color: #fff;
    padding: 40px 5% 10px 5%;
    font-size: 14px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    padding-bottom: 30px;
    border-bottom: 1px solid #444;
}

.footer-logo {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.footer-left {
    display: flex;
    flex-direction: column;
}

.footer-links {
    display: flex;
    gap: 50px;
}

.link-group {
    display: flex;
    flex-direction: column;
}

.link-group a {
    color: #ccc;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-size: 12px;
}

.footer-right p {
    margin-bottom: 15px;
    text-align: right;
}

.copyright {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    color: #555;
}

/* ================================================= */
/* 2. TRANG SẢN PHẨM (Product Page) */
/* ================================================= */

/* Layout chính: Sidebar + Content (Flexbox) */
.product-page-container {
    display: flex;
    padding: 40px 5%;
    background-color: var(--color-secondary); 
    position: relative; 
}

/* --- Sidebar/Bộ lọc --- */
.sidebar-filters {
    flex-shrink: 0;
    width: 280px; 
    padding-right: 40px;
    transition: transform 0.3s ease-in-out; 
}

/* Header bên trong sidebar (chỉ hiện trên mobile) */
.sidebar-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    text-transform: uppercase;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--color-primary);
}

/* Nút mở bộ lọc trên mobile */
.mobile-filter-toggle {
    display: none; 
    background-color: var(--color-primary);
    color: #fff;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    margin-bottom: 20px;
    font-size: 14px;
}
.mobile-filter-toggle i {
    margin-right: 5px;
}

/* Kiểu cho từng nhóm Filter Group */
.filter-group {
    border-top: 1px solid #ccc;
    padding: 15px 0;
}
.filter-group.last-filter {
    border-bottom: 1px solid #ccc;
}

/* Tiêu đề Bộ lọc (Dùng thẻ summary) */
.filter-group summary.filter-title {
    /* Xóa dấu tam giác mặc định của trình duyệt */
    list-style: none;
    list-style-type: none;

    font-size: 16px;
    font-weight: bold;
    color: var(--color-primary);
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 5px;
}

/* Xóa dấu tam giác mặc định trên Webkit (Chrome/Safari) */
.filter-group summary.filter-title::-webkit-details-marker {
    display: none;
}

/* Mũi tên cho nhóm có thể mở/đóng */
.filter-group details summary.filter-title i {
    font-size: 12px;
    transition: transform 0.3s;
    transform: rotate(0deg); /* Mặc định mũi tên xuống */
}

/* Khi details MỞ, xoay mũi tên lên */
.filter-group details[open] summary.filter-title i {
    transform: rotate(180deg); 
}

/* Mũi tên cho nhóm TĨNH (Đánh giá, Giá, Khác) */
.filter-group.static-filter summary.filter-title i {
    transform: rotate(-90deg); /* Mũi tên chỉ sang phải */
}

/* Nội dung bộ lọc */
.filter-options {
    padding: 10px 0 5px 0; 
}

/* --- Custom Checkbox Style --- */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 14px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 14px;
    width: 14px;
    background-color: transparent;
    border: 1px solid var(--color-text);
}

.checkbox-container:hover input ~ .checkmark {
    background-color: #eee;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--color-primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 1px 1px 0;
    -webkit-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    transform: rotate(45deg);
}


/* --- Khu vực Hiển thị Sản phẩm --- */
.product-listing-area {
    flex-grow: 1;
    padding-left: 40px;
}

.listing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    margin-bottom: 30px;
}

.listing-header h2 {
    font-size: 24px;
    font-weight: bold;
    text-transform: none;
}

.sort-by label {
    font-size: 14px;
    color: var(--color-light-text);
}

.sort-by select {
    border: none;
    background: none;
    font-weight: bold;
    font-size: 14px;
    appearance: none; 
    padding-right: 15px; 
}

/* Lưới Sản phẩm (CSS Grid) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 cột trên desktop */
    gap: 30px;
    text-align: left;
}

/* --- Thẻ Sản phẩm (Product Card) --- */
.product-card {
    text-align: left;
}

.product-image-container {
    position: relative;
    overflow: hidden;
}

.product-image-container img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.sale-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #e74c3c;
    color: #fff;
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 50%;
    z-index: 2;
}

.product-card h4 {
    margin-top: 10px;
    font-size: 16px;
    text-transform: none;
    font-weight: bold;
}

.product-card .price {
    font-weight: bold;
    margin: 5px 0;
}

.product-card .old-price {
    color: var(--color-light-text);
    font-weight: normal;
}

.product-card .description {
    color: var(--color-light-text);
    font-size: 14px;
    margin-bottom: 10px;
}

.add-to-cart {
    display: inline-block;
    color: var(--color-light-text);
    font-size: 12px;
    margin-top: 5px;
    border-bottom: 1px solid var(--color-light-text);
    padding-bottom: 2px;
}

.load-more-btn {
    margin: 50px auto 20px;
    display: block;
}

/* ================================================= */
/* 3. MEDIA QUERIES for Responsiveness (Product Page) */
/* ================================================= */

/* Tablet & Smaller Desktop */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 cột trên tablet */
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    /* Header/Navigation Mobile */
    .navbar {
        padding: 10px 5%;
    }
    
    .nav-left, .nav-right {
        /* Ẩn menu navigation mặc định */
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 60px;
        left: 0;
        background-color: #fff;
        border-top: 1px solid #eee;
        z-index: 10;
        padding: 10px 0;
    }

    /* Kích hoạt menu mobile */
    .nav-left.active, .nav-right.active {
        display: flex;
    }

    .nav-left a, .nav-right a {
        margin: 10px 0;
        text-align: center;
    }
    
    .logo {
        position: static;
        transform: none;
        order: 2;
        flex-grow: 1;
        text-align: center;
    }

    .menu-toggle {
        display: block;
        order: 1;
    }

    .nav-right {
        order: 3;
    }

    /* Main Content Mobile */
    .product-page-container {
        flex-direction: column;
        padding: 30px 5%;
    }

    .product-listing-area {
        padding-left: 0;
    }
    
    .product-grid {
        grid-template-columns: 1fr; /* 1 cột trên mobile */
        gap: 20px;
    }

    /* --- Mobile Filter Toggle --- */
    .mobile-filter-toggle {
        display: block;
    }
    
    /* Overlay làm tối nền */
    .filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
    .filter-overlay.active {
        display: block;
    }
    
    /* Sidebar Mobile Pop-up */
    .sidebar-filters {
        position: fixed;
        top: 0;
        left: 0;
        width: 80vw; 
        height: 100vh;
        background-color: #fff;
        z-index: 100;
        transform: translateX(-100%); /* Ẩn sidebar ban đầu */
        padding: 20px 5%;
        overflow-y: scroll; 
    }

    .sidebar-filters.active {
        transform: translateX(0); /* Hiện sidebar */
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-header {
        display: flex;
    }
    
    /* Điều chỉnh các bộ lọc trên mobile */
    .filter-group {
        border-top: 1px solid #eee;
        padding: 10px 0;
    }
    .filter-group.last-filter {
        border-bottom: none;
    }
    
    /* Footer Mobile */
    .footer-content {
        flex-direction: column;
    }

    .footer-left {
        margin-bottom: 30px;
    }

    .footer-links {
        gap: 20px;
    }

    .footer-right p {
        text-align: left;
    }
}