/* Thiết lập cơ bản */
body {
    font-family: 'Roboto', sans-serif;
    padding: 0;
    background-color: #f4f4f4;
}

/* Áp dụng font Montserrat cho các tiêu đề (nổi bật) */
h1, h2, h3, header {
    font-family: 'Montserrat', sans-serif;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Ô tìm kiếm */
.filter-controls {
    margin-bottom: 20px;
}

#searchInput {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* --- PRODUCT GRID (CSS GRID) --- */

.product-grid {
    display: grid;
    gap: 20px; /* Khoảng cách giữa các sản phẩm */
    padding-bottom: 20px;
}

/* Mặc định cho Mobile (Smartphone): 2 cột */
.product-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* Media Query cho Màn hình lớn hơn (Web/Tablet): 4 cột */
/* Thường áp dụng cho màn hình có chiều rộng từ 768px trở lên */
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Kiểu dáng cho từng Sản phẩm */
.product-item {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease; /* Thêm transition để hiệu ứng mượt mà */
    cursor: pointer;
}
.product-link {
    text-decoration: none; /* Xóa gạch chân mặc định của link */
    color: inherit; /* Giữ màu chữ mặc định */
}

/* Áp dụng hiệu ứng hover (Di chuột qua) */
.product-link:hover .product-item {
    transform: translateY(-5px); /* Hiệu ứng dịch chuyển lên nhẹ */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); /* Đổ bóng mạnh hơn */
}


.product-item h3 {
    margin-top: 10px;
    font-size: 1.1em;
    color: #333;
}

.product-item p {
    color: #777;
    font-size: 0.9em;
}

/* Hình ảnh */
.product-item-image img{
    width: 100%;
    background-color: #eee;
    border-radius: 4px;
    object-fit: cover; 
    object-position: center;
}

/* --- PHÂN TRANG --- */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    margin: 0 5px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.pagination button:hover:not(.active) {
    background-color: #0056b3;
}

.pagination button.active {
    background-color: #0056b3;
    font-weight: bold;
    cursor: default;
}

.pagination button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.loading-container {
    display: none; /* Mặc định ẩn đi */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 50px 0;
    width: 100%;
    min-height: 150px; /* Chiều cao tối thiểu để loading không bị giật */
    grid-column: 1 / -1; /* Đảm bảo nó chiếm toàn bộ chiều rộng grid */
    text-align: center;
}

/* Spinner (Vòng tròn quay) */
.spinner {
    border: 8px solid #f3f3f3; /* Màu xám nhạt */
    border-top: 8px solid #007bff; /* Màu xanh dương (màu chính) */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite; /* Áp dụng hiệu ứng quay */
    margin-bottom: 15px;
}

/* Keyframes cho hiệu ứng quay */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Class để hiển thị Loading */
.show-loading {
    display: flex; /* Hiển thị loading */
}

/* Ẩn product list khi loading */
.hide-products {
    display: none !important;
}