/* =========================================================
   MOTOX PRODUCT CARD
   Đen - trắng - đỏ #D52927, góc cắt vát kiểu đồ đua
   ========================================================= */

.custom-product-card-wrapper,
.custom-product-card-wrapper .e-con-inner,
.custom-product-card-wrapper .elementor-widget-shortcode,
.custom-product-card-wrapper .elementor-shortcode {
    height: 100%;
}

.custom-product-card {
    /* Màu */
    --mx-red: #D52927;
    --mx-red-dark: #a40000;
    --mx-black: #111111;
    --mx-text: #1a1a1a;
    --mx-muted: #8a8a8a;
    --mx-border: #e6e6e6;
    --mx-image-bg: #f4f4f4;

    /* Chiều cao cố định từng vùng -> các thẻ thẳng hàng ngang nhau */
    --card-title-lines: 2;
    --card-title-line-height: 1.3em;
    --card-price-height: 24px;
    --card-swatch-size: 36px;

    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    max-width: 350px;
    height: 100%;
    margin: 0 auto;
    padding: 0 0 16px;
    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 */
.custom-product-card::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;
}

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

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

/* ---------- TAG GIẢM GIÁ: nhãn đỏ cắt vát ---------- */
.custom-product-card .sale-tag {
    position: absolute;
    top: 12px;
    left: 0;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    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;
    clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
    border-radius: 0;
}

/* ---------- VÙNG 1: HÌNH ---------- */
.custom-product-card .product-image-container {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--mx-image-bg);
}

.custom-product-card .product-image-container a {
    flex: 1;
    display: flex;
    height: 100%;
    padding: 18px;
    box-sizing: border-box;
}

.custom-product-card .product-main-image {
    width: 100%;
    height: 100%;
    margin: auto;
    object-fit: contain;
    object-position: center;
    /* Ảnh nền trắng hòa vào nền xám, không bị lộ khung trắng */
    mix-blend-mode: multiply;
    transition: transform .4s ease;
}

.custom-product-card:hover .product-main-image {
    transform: scale(1.05);
}

/* ---------- VÙNG 2 + 3: TITLE + GIÁ ---------- */
.custom-product-card .product-content {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    padding: 0 16px;
}

.custom-product-card .product-title-link {
    text-decoration: none;
}

.custom-product-card .product-title {
    width: 100%;
    margin: 16px 0 8px;
    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;
    /* Cố định chiều cao = số dòng tối đa */
    height: calc(var(--card-title-line-height) * var(--card-title-lines));
    cursor: pointer;
    transition: color .2s ease;
}

.custom-product-card:hover .product-title {
    color: var(--mx-red);
}

.custom-product-card .product-price {
    min-height: var(--card-price-height);
    color: var(--mx-red) !important;
    font-size: 17px !important;
    font-weight: 800;
    line-height: var(--card-price-height);
    letter-spacing: .01em;
    text-align: center;
}

.custom-product-card p {
    margin-bottom: 0;
}

.custom-product-card .product-price del,
.product .woocommerce-LoopProduct-link .price del {
    display: none !important;
}

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

/* ---------- VÙNG 4: SWATCH ---------- */
.custom-product-card .product-variation-swatches {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    min-height: var(--card-swatch-size);
    margin-top: auto;
    padding: 14px 16px 0;
}

.custom-product-card .variation-swatch-item {
    width: var(--card-swatch-size) !important;
    height: var(--card-swatch-size) !important;
    border: 1px solid var(--mx-border);
    border-radius: 3px !important;
    background: var(--mx-image-bg);
    overflow: hidden;
    box-sizing: border-box;
    transition: border-color .2s ease, transform .2s ease;
}

.custom-product-card .variation-swatch-item > a {
    display: flex;
    width: 100%;
    height: 100%;
}

.custom-product-card .variation-swatch-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0 !important;
    mix-blend-mode: multiply;
}

.custom-product-card .variation-swatch-item:hover {
    border-color: var(--mx-red);
    outline: 1px solid var(--mx-red);
    box-shadow: none !important;
    transform: translateY(-2px);
}

/* ---------- MOBILE ---------- */
@media (max-width: 767px) {
    .custom-product-card {
        --card-swatch-size: 30px;
        padding-bottom: 12px;
    }

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

    .custom-product-card .product-image-container a {
        padding: 10px;
    }

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

    .custom-product-card .product-title {
        font-size: 12px;
        margin: 12px 0 6px;
    }

    .custom-product-card .product-price {
        font-size: 14px !important;
    }

    .custom-product-card .sale-tag {
        top: 8px;
        font-size: 10px;
        padding: 4px 10px 4px 8px;
    }

    .custom-product-card .product-variation-swatches {
        gap: 4px;
        padding: 10px 10px 0;
    }
}