/* =========================================================
   MOTOX - THẺ SẢN PHẨM DÙNG TEMPLATE WOO (.product-custom)
   Cùng phong cách với .custom-product-card
   ========================================================= */

.product-custom {
    --mx-red: #D52927;
    --mx-black: #111111;
    --mx-text: #1a1a1a;
    --mx-border: #e6e6e6;
    --mx-image-bg: #f4f4f4;

    --card-title-lines: 2;
    --card-title-line-height: 1.3em;
    --card-price-height: 24px;
    --card-swatch-size: 36px;
}

/* --- BỐ CỤC CHUNG --- */

.e-loop-item .product-custom .e-con-inner {
    background: transparent;
    justify-content: center;
    flex-direction: row;
    padding: 0;
}

.e-loop-item .product-custom .elementor-shortcode,
.product-custom .elementor-widget-shortcode {
    width: 100%;
    height: 100%;
}

/* Khung thẻ */
.product-custom .product {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
    margin: 0 !important;
    padding: 0 0 16px !important;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--mx-border);
    border-radius: 4px;
    overflow: hidden;
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

/* Vạch đỏ chạy dưới đáy khi hover */
.product-custom .product::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: var(--mx-red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s ease;
    z-index: 2;
}

.product-custom .product:hover {
    border-color: var(--mx-black);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
    transform: translateY(-3px);
}

.product-custom .product:hover::after {
    transform: scaleX(1);
}

/* --- HÌNH ẢNH --- */

.product-custom .product .woocommerce-LoopProduct-link {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    text-decoration: none;
}

/* Nền xám phía sau ảnh (vùng vuông trên cùng) */
.product-custom .product .woocommerce-LoopProduct-link::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--mx-image-bg);
}

.product-custom .product img.attachment-woocommerce_thumbnail {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 !important;
    padding: 18px;
    box-sizing: border-box;
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    /* Ảnh nền trắng hòa vào nền xám */
    mix-blend-mode: multiply;
    transition: transform .4s ease;
}

.product-custom .product:hover img.attachment-woocommerce_thumbnail {
    transform: scale(1.05);
}

/* --- TAG SALE: nhãn đỏ cắt vát --- */

.product-custom .product .onsale {
    position: absolute;
    top: 12px !important;
    left: 0 !important;
    right: auto !important;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    width: auto;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 5px 14px 5px 12px;
    background: var(--mx-red);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 16px;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-radius: 0;
    clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

/* --- TÊN, GIÁ --- */

.product-custom .product h2.woocommerce-loop-product__title {
    width: 100%;
    margin: 16px 0 8px;
    padding: 0 16px;
    box-sizing: border-box;
    color: var(--mx-text);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    text-align: center;
    line-height: var(--card-title-line-height);
    display: -webkit-box;
    -webkit-line-clamp: var(--card-title-lines);
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: calc(var(--card-title-line-height) * var(--card-title-lines));
    min-height: 0;
    max-height: none;
    cursor: pointer;
    transition: color .2s ease;
}

.product-custom .product:hover h2.woocommerce-loop-product__title {
    color: var(--mx-red);
}

.product-custom .product .price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    min-height: var(--card-price-height);
    margin: 0;
    padding: 0 16px;
    color: var(--mx-red) !important;
    font-size: 17px !important;
    font-weight: 800;
    line-height: var(--card-price-height);
}

.product-custom .product .price ins {
    text-decoration: none;
}

.price del,
.product-price del {
    color: #b9bcc0;
    font-size: .8em;
    font-weight: 500;
}

/* --- SWATCHES (CFVSW) --- */

.product-custom .product .cfvsw_variations_form {
    display: flex;
    justify-content: center;
    min-height: var(--card-swatch-size);
    margin-top: auto;
    padding: 14px 16px 0;
}

.product-custom .product .cfvsw_variations_form table,
.product-custom .product .cfvsw_variations_form td {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.product-custom tr .label {
    display: none;
}

.product-custom tr .value {
    background: transparent;
    justify-content: center;
}

.product-custom .cfvsw-swatches-container {
    justify-content: center;
    gap: 6px;
}

.product-custom tr .cfvsw-swatches-option {
    width: var(--card-swatch-size) !important;
    height: var(--card-swatch-size) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    border: 1px solid var(--mx-border) !important;
    border-radius: 3px !important;
    background-color: var(--mx-image-bg);
    color: var(--mx-text);
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    box-sizing: border-box;
    transition: border-color .2s ease, transform .2s ease;
}

.product-custom tr .cfvsw-swatches-option img {
    mix-blend-mode: multiply;
    object-fit: contain;
}

.product-custom tr .cfvsw-swatches-option:hover {
    border-color: var(--mx-red) !important;
    transform: translateY(-2px);
}

.product-custom tr .cfvsw-selected-swatch {
    border-color: var(--mx-red) !important;
    outline: 1px solid var(--mx-red);
}

/* Ẩn nút thêm vào giỏ trên thẻ */
.product-custom .product .cfvsw_ajax_add_to_cart,
.product-custom .product .product_type_simple {
    display: none !important;
}

/* --- MOBILE --- */

@media (max-width: 767px) {
    .product-custom {
        --card-swatch-size: 30px;
    }

    .product-custom .product {
        padding-bottom: 12px !important;
    }

    .product-custom .product:hover {
        transform: none;
    }

    .product-custom .product img.attachment-woocommerce_thumbnail {
        padding: 10px;
    }

    .product-custom .product h2.woocommerce-loop-product__title {
        font-size: 12px;
        margin: 12px 0 6px;
        padding: 0 10px;
    }

    .product-custom .product .price {
        font-size: 14px !important;
        padding: 0 10px;
    }

    .product-custom .product .onsale {
        top: 8px !important;
        font-size: 10px;
        padding: 4px 10px 4px 8px;
    }

    .product-custom .product .cfvsw_variations_form {
        padding: 10px 10px 0;
    }

    .product-custom .cfvsw-swatches-container {
        gap: 4px;
    }
}

/* --- PHÂN TRANG --- */

.products-grid .elementor-pagination {
    --pg-size: 40px;
    --pg-red: #D52927;
    --pg-black: #111111;
    --pg-border: #e6e6e6;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
}

/* Ô số trang */
.products-grid .elementor-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--pg-size);
    height: var(--pg-size);
    margin: 0 !important;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1px solid var(--pg-border);
    border-radius: 3px;
    background: #fff;
    color: var(--pg-black);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.products-grid .elementor-pagination a.page-numbers:hover {
    border-color: var(--pg-red);
    color: var(--pg-red);
}

/* Trang hiện tại */
.products-grid .elementor-pagination .page-numbers.current {
    border-color: var(--pg-black);
    background: var(--pg-black);
    color: #fff;
    position: relative;
    border-radius: 0px;
}

/* Gạch đỏ dưới trang hiện tại */
.products-grid .elementor-pagination .page-numbers.current::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 5px;
    height: 2px;
    background: var(--pg-red);
}

/* Dấu ... */
.products-grid .elementor-pagination .page-numbers.dots {
    min-width: auto;
    padding: 0 4px;
    border-color: transparent;
    background: transparent;
    color: #9a9a9a;
}

/* Previous / Tiếp theo */
.products-grid .elementor-pagination .page-numbers.prev,
.products-grid .elementor-pagination .page-numbers.next {
    padding: 0 16px;
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.products-grid .elementor-pagination .page-numbers.prev::before {
    content: "←";
    margin-right: 8px;
    font-size: 14px;
}

.products-grid .elementor-pagination .page-numbers.next::after {
    content: "→";
    margin-left: 8px;
    font-size: 14px;
}

.products-grid .elementor-pagination a.page-numbers.prev:hover,
.products-grid .elementor-pagination a.page-numbers.next:hover {
    background: var(--pg-red);
    border-color: var(--pg-red);
    color: #fff;
}

/* Nút Previous/Tiếp theo bị vô hiệu (đang ở trang đầu/cuối) */
.products-grid .elementor-pagination span.page-numbers.prev,
.products-grid .elementor-pagination span.page-numbers.next {
    opacity: .35;
    cursor: default;
}

/* Mobile: thu nhỏ, ẩn chữ Previous/Tiếp theo chỉ giữ mũi tên */
@media (max-width: 767px) {
    .products-grid .elementor-pagination {
        --pg-size: 36px;
        gap: 4px;
    }

    .products-grid .elementor-pagination .page-numbers {
        padding: 0 8px;
        font-size: 13px;
    }

    .products-grid .elementor-pagination .page-numbers.prev,
    .products-grid .elementor-pagination .page-numbers.next {
        width: var(--pg-size);
        padding: 0;
        font-size: 0;
    }

    .products-grid .elementor-pagination .page-numbers.prev::before,
    .products-grid .elementor-pagination .page-numbers.next::after {
        margin: 0;
        font-size: 16px;
    }
}

.products-grid .star-rating {
    display: none !important;
}