/* --- CODE FIX CHO TABLET VÀ MOBILE (Dưới 991px) --- */
/* Thay vì để 500px, ta để 991px để bao gồm cả iPad/Tablet */
@media screen and (max-width: 991px) {

    /* 1. Thiết lập Grid Layout (2 cột) */
    .japanese_products_on .products {
        display: grid;
        grid-template-columns: 1fr 1fr; /* Chia 2 cột đều nhau */
        gap: 15px;                  /* Tăng khoảng cách lên 15px cho thoáng hơn trên Tablet */
        height: auto !important;    /* Reset chiều cao cứng */
        padding: 0 15px;            
        margin-bottom: 30px;
    }

    /* 2. Reset toàn bộ thuộc tính cũ của item */
    /* Gộp các selector lại cho gọn */
    .japanese_products_on .products .item_products,
    .japanese_products_on .products .item_products:nth-child(1),
    .japanese_products_on .products .item_products:nth-child(2),
    .japanese_products_on .products .item_products:nth-child(3),
    .japanese_products_on .products .item_products:nth-child(4) {
        width: 100% !important;     
        height: auto !important;    
        aspect-ratio: 2 / 3.2;      /* Tỉ lệ khung ảnh (2 rộng : 3.2 cao) */
        
        position: relative !important; /* Bỏ absolute để Grid hoạt động */
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        
        zoom: 1 !important;         /* QUAN TRỌNG: Khử zoom 0.8 của code cũ */
        margin: 0 !important;
    }

    /* 3. XỬ LÝ HOVER (Tablet/Mobile nên tắt scale) */
    .japanese_products_on .products .item_products:hover {
        transform: none !important;
        -webkit-transform: none !important;
    }
    
    .japanese_products_on .products .item_products:hover .bg::before {
        visibility: visible;
        opacity: 1;
    }

    /* 4. Ảnh full khung */
    .japanese_products_on .products .item_products img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* 5. Chỉnh lại vị trí Text */
    .japanese_products_on .products .item_products .text-pro {
        position: absolute;
        bottom: 15px;
        right: 0;
        left: 0;
        
        transform: none !important; 
        -webkit-transform: none !important;
        
        text-align: center; 
        font-size: 18px !important; /* Tablet để chữ 18px cho rõ */
        line-height: 1.2;
    }
    
    .japanese_products_on .products .item_products .text-pro span {
        font-size: 18px !important;
        line-height: 1.2;
    }

    /* 6. Ô trang trí số 5 (Logo) */
    .japanese_products_on .products .item_products:nth-child(5) {
        position: absolute !important; 
        width: 100px !important; /* Tablet cho to hơn mobile chút (100px) */
        height: auto !important;
        right: 0 !important;
        bottom: -15px !important;
        z-index: 10;
        background: transparent;
        pointer-events: none;
    }
    
    .japanese_products_on .products .item_products:nth-child(5) .bg {
        display: none; 
    }
}

/* --- Tinh chỉnh riêng cho màn hình siêu nhỏ (Mobile dưới 400px) --- */
/* Để chữ không bị to quá trên các máy đời cũ */
@media screen and (max-width: 400px) {
    .japanese_products_on .products .item_products .text-pro,
    .japanese_products_on .products .item_products .text-pro span {
        font-size: 14px !important;
    }
    
    .japanese_products_on .products .item_products:nth-child(5) {
        width: 70px !important;
    }
}