/* =====================================================================
 * B2B "Call for Price" - Zalo CTA
 * Ẩn công cụ mua hàng mặc định, style nút Zalo, ẩn badge Sale/Out of stock.
 * ===================================================================== */

/* ---- 1) Ẩn cụm mua hàng gốc của WooCommerce (giữ nguyên cấu trúc DOM/form) ---- */
.variations_form .quantity,
.variations_form .single_add_to_cart_button,
.variations_form input[name="add-to-cart"],
form.cart .quantity,
form.cart .single_add_to_cart_button,
.woocommerce-variation-availability,
/* Nút "Mua ngay" riêng của Flatsome (ux-buy-now-button) - không phải template
   gốc của WooCommerce nên phải ẩn riêng, ngoài .single_add_to_cart_button. */
.ux-buy-now-button {
    display: none !important;
}

/* Vùng giá biến thể mặc định của Woo (được JS đổ price_html vào) không còn
   dữ liệu để hiển thị (đã strip ở PHP) nên chỉ cần ẩn wrapper cho gọn UI. */
.woocommerce-variation-price {
    display: none !important;
}

/* ---- 2) Nút CTA Zalo ----
 * Audit theo chuẩn Google (Material Design 3 + web.dev accessibility):
 * - Nền màu đặc #0068FF (không dùng gradient sáng dần) vì #0080FF khi phối
 *   với chữ trắng chỉ đạt ~3.8:1, KHÔNG đạt WCAG AA cho text thường (yêu cầu
 *   tối thiểu 4.5:1). #0068FF đạt ~4.75:1 - an toàn. #0080FF vẫn giữ lại làm
 *   glow/shadow khi hover, không dùng làm nền chứa chữ.
 * - Hover/active chuyển sang tối hơn (không sáng hơn) - vừa tăng độ tương
 *   phản vừa đúng quy ước "trạng thái nhấn = đậm hơn" của Material state layer.
 * - min-height 44px: đạt WCAG 2.5.5 (kích thước vùng chạm tối thiểu 44x44px)
 *   và gần chuẩn 48dp touch target của Material Design.
 * - :focus-visible có outline rõ ràng cho điều hướng bàn phím (WCAG 2.4.7).
 * - Tôn trọng prefers-reduced-motion (mục 2b bên dưới).
 * - Giữ nguyên bo góc 4px theo yêu cầu ban đầu (không đổi sang pill của M3).
 *
 * `display`/`margin` dùng !important: Flatsome có sẵn `.box a{display:inline-block}`
 * (specificity 0,1,1) và `.box-text a:not(.button){margin:0.1em 0}` (0,2,1) -
 * cả hai đều thắng class đơn `.mhnv-zalo-cta` (0,1,0) theo specificity thông
 * thường, khiến icon và chữ bị rớt xuống 2 dòng thay vì nằm ngang. Đây là
 * cách override có chủ đích, đúng quy ước đã dùng cho `.ux-buy-now-button`
 * ở mục (1) phía trên, không phải lạm dụng !important tràn lan. */
.mhnv-zalo-cta {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    margin: 0 !important;
    background-color: #0068ff;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 30, 90, 0.25);
}

.mhnv-zalo-cta:hover {
    background-color: #0052cc;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 82, 204, 0.35), 0 0 0 3px rgba(0, 128, 255, 0.15);
    text-decoration: none;
}

.mhnv-zalo-cta:active {
    background-color: #0045ad;
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0, 30, 90, 0.25);
}

.mhnv-zalo-cta:focus-visible {
    outline: 2px solid #0045ad;
    outline-offset: 2px;
}

.mhnv-zalo-cta__icon {
    display: block;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
}

.mhnv-zalo-cta__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- 2b) Tôn trọng prefers-reduced-motion (web.dev: respect user motion preference) ---- */
@media (prefers-reduced-motion: reduce) {
    .mhnv-zalo-cta {
        transition: none;
    }

    .mhnv-zalo-cta:active {
        transform: none;
    }

    .mhnv-zalo-cta__text-wrap .mhnv-zalo-cta__text {
        transition: none;
    }

    .mhnv-zalo-cta--price:hover .mhnv-zalo-cta__icon {
        animation: none;
    }
}

/* ---- 2c) Nút trong Product Grid/Loop (.mhnv-zalo-cta--price): đổi text khi
 * hover bằng hiệu ứng trượt CSS thuần (2 dòng text chồng lên nhau trong 1
 * khối chiều cao cố định = 1 dòng, dùng transform/opacity nên không ảnh
 * hưởng kích thước nút -> không giật layout). Icon rung nhẹ 1 lần kèm theo
 * để nhấn mạnh trạng thái tương tác. */
.mhnv-zalo-cta__text-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    height: 1.3em;
    overflow: hidden;
}

.mhnv-zalo-cta__text-wrap .mhnv-zalo-cta__text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mhnv-zalo-cta__text--default {
    transform: translateY(0);
    opacity: 1;
}

.mhnv-zalo-cta__text--hover {
    transform: translateY(110%);
    opacity: 0;
}

.mhnv-zalo-cta--price:hover .mhnv-zalo-cta__text--default {
    transform: translateY(-110%);
    opacity: 0;
}

.mhnv-zalo-cta--price:hover .mhnv-zalo-cta__text--hover {
    transform: translateY(0);
    opacity: 1;
}

.mhnv-zalo-cta--price:hover .mhnv-zalo-cta__icon {
    animation: mhnv-zalo-icon-shake 0.5s ease-in-out;
}

@keyframes mhnv-zalo-icon-shake {
    0%, 100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-12deg);
    }

    75% {
        transform: rotate(12deg);
    }
}

/* CTA trong khung giá của danh sách/lưới sản phẩm (archive, related, upsell,
 * slider trang chủ...) - full-width theo chiều rộng thẻ sản phẩm, đồng bộ
 * với các nút "Thêm vào giỏ hàng" mặc định của theme để không phá layout. */
.mhnv-zalo-cta--price {
    width: 100%;
}

/* CTA chính trong trang chi tiết sản phẩm - nổi bật, cao hơn 1 chút vì là
 * hành động chính (primary action) của trang, full width trên mobile. */
.mhnv-zalo-cta--single {
    width: 100%;
    max-width: 360px;
    min-height: 48px;
    padding: 13px 20px;
    font-size: 15px;
    margin-top: 8px;
}

.mhnv-zalo-variation-info {
    margin-top: 8px;
    font-size: 13px;
    color: #555;
    min-height: 18px;
}

/* ---- 3) Toast xác nhận copy nội dung ---- */
.mhnv-zalo-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 12px);
    background: #1f2937;
    color: #fff;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9999;
}

.mhnv-zalo-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---- 4) Ẩn badge "Sale" / "Out of stock" ở mọi nơi ---- */
.onsale,
span.onsale,
.product-badge.sale,
.stock.out-of-stock,
p.stock.out-of-stock,
.out-of-stock-badge,
.product-badge.out-of-stock {
    display: none !important;
}

/* ---- 5) Ẩn giỏ hàng mini trên header ----
 * .header-cart-link là class thật của Flatsome (kiểm tra trực tiếp trên
 * theme đang chạy, cả bản desktop lẫn mobile off-canvas). Giữ thêm vài
 * selector chuẩn Woo phòng khi có widget giỏ hàng chèn ở vị trí khác. */
#header .header-cart-link,
.off-canvas-cart,
.woocommerce-mini-cart,
.widget_shopping_cart {
    display: none !important;
}

/* ---- 6) Responsive mobile ----
 * Nút CTA chính trên trang chi tiết: bỏ giới hạn max-width 360px (không cần
 * thiết trên màn hẹp) và tăng nhẹ font-size lên 16px - theo khuyến nghị của
 * Google (web.dev "Mobile Web Best Practices") để chữ trên nút hành động
 * chính dễ đọc, dễ bấm bằng ngón tay ở khoảng cách xem điện thoại thông thường. */
@media (max-width: 549px) {
    .mhnv-zalo-cta--single {
        max-width: 100%;
        padding: 14px 16px;
        font-size: 16px;
    }
}
