/* ===================================================================== */
/* CSS CHO KHU VỰC SẢN PHẨM (ĐỒNG BỘ GIAO DIỆN & TỐI ƯU HIỂN THỊ)        */
/* ===================================================================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-title {
    text-transform: uppercase;
    font-size: 22px;
    color: #333;
    margin: 0;
}

.see-more {
    text-decoration: none;
    color: #2e8b57;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.3s;
}
.see-more:hover { color: #388e3c; }

/* Lưới sản phẩm mặc định trên PC: Đổi từ 5 thành 4 cột */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px;
}

/* Thẻ sản phẩm */
.product-card {
    background: white;
    padding: 20px 20px 25px 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e0e0e0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background-color: #ffffff;
    margin-bottom: 20px;
}

/* ĐÃ FIX LỖI VẠCH ĐEN Ở TIÊU ĐỀ: Khóa cứng tỷ lệ dòng, cấm dòng thứ 3 trồi lên */
.product-card h3 {
    margin-bottom: 10px; 
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    line-height: 19px; /* Chiều cao mỗi dòng cố định */
    height: 38px; /* Hộp cao ĐÚNG 38px (19px x 2 dòng) */
}
.product-title-link {
    color: #334155; 
    text-decoration: none;
    transition: color 0.3s ease;
}
.product-title-link:hover {
    color: #1a633a; 
}
.product-card .price {
    font-weight: bold;
    color: #e68a00; 
    margin-bottom: 15px; 
    font-size: 16px;
}
.btn-detail {
    display: block;
    width: 100%;
    text-align: center;
    border: 1px solid #1a633a; 
    color: #1a633a; 
    background: transparent; 
    text-decoration: none;
    padding: 10px 15px; 
    border-radius: 6px; 
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    margin-top: auto; 
}
.btn-detail:hover {
    background: #1a633a; 
    color: #ffffff; 
    box-shadow: 0 4px 12px rgba(26, 99, 58, 0.2); 
}

/* ===================================================================== */
/* ĐÃ FIX: KHỐI PHÂN TRANG (PAGINATION) BỀN VỮNG TRÊN MỌI THIẾT BỊ       */
/* ===================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
    padding-bottom: 20px;
    flex-wrap: wrap; /* Cho phép rớt dòng nếu nhiều nút trên điện thoại */
}
.page-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: white;
    color: #1e293b;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
}
.page-btn:hover {
    border-color: #1a633a;
    color: #1a633a;
}
.page-btn.active {
    background: #1a633a;
    color: white;
    border-color: #1a633a;
    box-shadow: 0 4px 10px rgba(26, 99, 58, 0.2);
}
.page-dots {
    color: #64748b;
    font-weight: 600;
    padding: 0 5px;
}

/* --- BẢN VÁ BLIND SPOT: RESPONSIVE CHO ĐIỆN THOẠI & TABLET --- */
@media (max-width: 1024px) {
    .product-grid {
        /* Ép iPad ngang cũng dùng 4 cột, hoặc bạn có thể đổi thành 2 cột */
        grid-template-columns: repeat(4, 1fr); 
    }
}

@media (max-width: 768px) {
    /* Giành lại quyền làm LƯỚI (Grid), đè bẹp lệnh Flexbox lướt ngang của home.css */
    .product-grid {
        display: grid !important; 
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 10px !important; 
        overflow-x: hidden !important; 
    }
    
    .product-card {
        padding: 10px !important; 
        flex: none !important; 
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .product-card img {
        margin-bottom: 10px !important;
    }

    /* ĐÃ FIX LỖI VẠCH ĐEN TRÊN MOBILE: Đồng bộ chiều cao dòng chặt chẽ */
    .product-card h3 {
        font-size: 13px !important; 
        line-height: 18px !important; /* Chiều cao mỗi dòng 18px */
        height: 36px !important; /* Hộp cao ĐÚNG 36px (18px x 2) */
        min-height: unset !important; /* Gỡ bỏ lệnh min-height cũ */
        margin-bottom: 8px !important;
    }
    
    .product-card .price {
        font-size: 14px !important; 
        margin-bottom: 12px !important;
    }
    .btn-detail {
        font-size: 11px !important; 
        padding: 8px 5px !important; 
    }

    /* Thu nhỏ nút phân trang trên mobile */
    .page-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}