/*
 * Style cho LP Advanced Gallery Frontend
 * ĐÃ KHẮC PHỤC LỖI CĂN CHỈNH GRID & FILTER NGÀY 09/10/2025
 */

/* ==================================== */
/* 1. CONTAINER CHUNG VÀ FILTER BAR */
/* ==================================== */
.lp-advanced-gallery-wrapper {
    margin-bottom: 30px;
}

.lpag-category-filter {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: center; 
    flex-wrap: wrap; 
}

.lpag-filter-item {
    display: flex; 
    align-items: center; 
    justify-content: center; 

    padding: 8px 15px; 
    margin: 0 5px 10px;
    
    background-color: #f7f7f7;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
    font-size: 14px;
    border: 1px solid #eee;
    
    /* KHẮC PHỤC CĂN GIỮA BẰNG LINE-HEIGHT RẤT THẤP */
    line-height: 0.2; 
    height: 36px; 
    box-sizing: border-box; 
}

.lpag-filter-item:hover {
    background-color: #e0e0e0;
}

.lpag-filter-item.active {
    background-color: #006c84; 
    color: #fff;
    border: 1px solid #3abfff; 
    
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border-bottom: 3px solid #3abfff;
    margin-bottom: 8px; 
}

/* ==================================== */
/* 2. GRID LAYOUT & COLUMN CONTROL */
/* ==================================== */

#lpag-gallery-container {
    display: grid;
    gap: 15px;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    align-items: start;
    /* KHẮC PHỤC LỖI 1: Đảm bảo các hàng bắt đầu từ đầu */
    grid-auto-rows: minmax(200px, auto); /* Đặt chiều cao hàng tối thiểu */
}

.lpag-grid-layout {
    grid-template-columns: repeat(var(--lpag-cols, 4), 1fr); 
}

@media (max-width: 768px) {
    .lpag-grid-layout {
        grid-template-columns: repeat(2, 1fr);
    }
}

#lpag-gallery-container.loading-gallery {
    opacity: 0.5;
    pointer-events: none;
}

/* ==================================== */
/* 3. ITEM ẢNH VÀ HIỆU ỨNG HOVER */
/* ==================================== */

.lpag-gallery-item {
    position: relative;
    overflow: hidden;
    line-height: 0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: 100%; /* Đảm bảo item chiếm hết chiều cao hàng */
}

.lpag-gallery-item a {
    display: block;
    position: relative;
    height: 100%;
}

.lpag-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* QUAN TRỌNG: Đảm bảo ảnh lấp đầy khung mà không bị méo */
    display: block;
    transition: transform 0.3s ease-in-out;
}

.lpag-hover-overlay {
    /* ... giữ nguyên ... */
}