/* =====================================================
   NONG NGHIEP XANH - PRODUCTS PAGE CSS (FULL)
   Trang danh sách sản phẩm & Bộ lọc tối giản (Full Responsive)
===================================================== */

/* 1. KHUNG CHỨA TRANG SẢN PHẨM */
#products {
    padding-top: 30px;
    padding-bottom: 60px;
}

/* =====================================================
   2. BỘ LỌC VÀ TÌM KIẾM (DESKTOP: 1 DÒNG NGANG)
===================================================== */
.product-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 30px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Đảm bảo trên Desktop luôn nằm trên 1 dòng duy nhất */
@media (min-width: 769px) {
    .product-filter-bar {
        flex-wrap: nowrap !important;
    }
}

.filter-group {
    display: flex;
    align-items: center;
}

/* Dropdown chọn Danh mục (Bên trái) */
.filter-left {
    flex: 0 0 240px;
    min-width: 240px;
}

.filter-left select#category-filter {
    width: 100%;
    height: 48px;
    padding: 10px 38px 10px 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    background-color: var(--white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23238636' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: var(--transition);
}

.filter-left select#category-filter:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(35, 134, 54, 0.12);
    outline: none;
}

/* Ô nhập Tìm kiếm (Bên phải - Tự giãn full chiều ngang còn lại, font 16px) */
.filter-right {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
}

.filter-right input#search-keyword {
    width: 100%;
    height: 48px;
    padding: 10px 16px 10px 46px;
    font-size: 16px;
    color: var(--text);
    background-color: var(--white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23777777' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    background-size: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}

.filter-right input#search-keyword:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(35, 134, 54, 0.12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23238636' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
}

.filter-right input#search-keyword::placeholder {
    font-size: 16px;
    color: var(--text-light);
}

/* =====================================================
   3. LƯỚI SẢN PHẨM (PRODUCT GRID)
===================================================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
    min-height: 300px;
}

/* Thông báo trạng thái */
.product-grid > p {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: #555e58;
    font-size: 15px;
    background: #fff;
    border: 1px dashed #edf0ed;
    border-radius: 8px;
    margin: 0;
}

/* =====================================================
   4. THẺ SẢN PHẨM (PRODUCT CARD - ĐỒNG BỘ STYLE.CSS)
===================================================== */
.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    background: #fff;
    border: 1px solid #edf0ed;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(20, 40, 25, 0.035);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(20, 40, 25, 0.10);
}

/* Hình ảnh sản phẩm */
.product-card > a {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f5f7f5;
    position: relative;
}

.product-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover img {
    transform: scale(1.035);
}

/* Thông tin chi tiết */
.product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px 16px 16px;
}

.product-card h3 {
    margin: 0 0 2px 0;
    color: #1a241e;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    min-height: calc(1.35em);
}

.product-card h3 a {
    color: inherit;
    text-decoration: none;
}

.product-card h3 a:hover {
    color: #238636;
}

.product-description {
    margin: 0 0 10px 0;
    color: #555e58;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    min-height: calc(1.45em * 2);
}

/* Giá sản phẩm */
.product-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 2px;
}

.regular-price,
.sale-price,
.product-card .price-current {
    color: #e84b35;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.old-price,
.product-card .price-old {
    color: #7a827d;
    font-size: 13px;
    font-weight: 500;
    text-decoration: line-through;
}

/* Nút Xem chi tiết (bên trái) + Nút Giỏ hàng (bên phải) */
.product-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    margin-top: 8px;
    border-top: 1px solid #edf0ed;
}

.product-actions .detail-btn {
    flex: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: #238636;
    background-color: #e8f5e9;
    border-radius: 6px;
    transition: all 0.25s ease;
    text-decoration: none;
}

.product-actions .detail-btn:hover {
    color: #fff;
    background-color: #238636;
}

.product-actions .add-cart-icon-btn {
    flex-shrink: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
    width: 38px;
    height: 38px;
    padding: 0;
    color: #fff;
    background-color: #238636;
    border: none;
    border-radius: 6px;
    transition: all 0.25s ease;
    cursor: pointer;
}

.product-actions .add-cart-icon-btn:hover:not(:disabled) {
    background-color: #17652a;
}

.product-actions .add-cart-icon-btn:disabled {
    background-color: #edf0ed;
    color: #7a827d;
    cursor: not-allowed;
    opacity: 0.7;
}

/* =====================================================
   5. RESPONSIVE HOÀN HẢO THEO MÀN HÌNH
===================================================== */

/* Laptop nhỏ (max-width: 1024px) */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
}

/* Tablet (max-width: 768px) */
@media (max-width: 768px) {
    .product-filter-bar {
        flex-wrap: wrap !important;
        gap: 12px;
    }

    .filter-left,
    .filter-right {
        width: 100%;
        min-width: 100%;
        flex: 1 1 100%;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

/* Mobile nhỏ (max-width: 480px) */
@media (max-width: 480px) {
    #products {
        padding-top: 20px;
        padding-bottom: 40px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .product-card {
        height: auto;
        border-radius: 9px;
    }

    .product-card > a {
        aspect-ratio: 1 / 1;
    }

    .product-info {
        padding: 10px 10px 12px;
    }

    .product-card h3 {
        font-size: 13px;
        line-height: 1.3;
        margin-bottom: 4px;
        height: 2.6em;
    }

    .regular-price,
    .sale-price,
    .product-card .price-current {
        font-size: 17px;
    }

    .old-price,
    .product-card .price-old {
        font-size: 12px;
    }

    .product-actions {
        padding-top: 6px;
        gap: 6px;
        margin-top: 6px;
    }

    .product-actions .detail-btn {
        height: 32px;
        font-size: 11px;
        padding: 0 4px;
        border-radius: 4px;
    }

    .product-actions .add-cart-icon-btn {
        width: 32px;
        height: 32px;
        border-radius: 4px;
    }

    .product-actions .add-cart-icon-btn svg {
        width: 15px;
        height: 15px;
    }
}