/**
 * BCE Product Showcase - Stylesheet v14.0 (Final Close Button Fix)
 * -- Chỉnh sửa ngày 01/07/2025: Sửa style ảnh sản phẩm --
 */

/**
 * =================================================================
 * SECTION 1: CAROUSEL WRAPPER & NAVIGATION
 * =================================================================
 */
.bce-product-showcase-wrapper{position:relative;overflow:hidden;padding:0;margin:0}

/* --- SỬA ĐỔI TẠI ĐÂY: Giảm cỡ chữ từ 24px xuống 19px --- */
.bce-product-showcase-wrapper .showcase-title{font-size:19px;font-weight:600;margin-bottom:20px}

.bce-product-showcase-carousel{visibility:hidden;opacity:0;transition:opacity .4s ease-in-out;padding:0;margin:0}
.bce-product-showcase-carousel.is-loaded{visibility:visible;opacity:1}
.bce-product-showcase-carousel .swiper-button-next,.bce-product-showcase-carousel .swiper-button-prev{position:absolute;top:50%;transform:translateY(-50%);margin-top:-35px;color:#000;background-color:rgba(255,255,255,.9);border-radius:50%;width:44px;height:44px;box-shadow:0 1px 4px rgba(0,0,0,.14);transition:opacity .2s,background-color .2s;z-index:10}
.bce-product-showcase-carousel .swiper-button-next:hover,.bce-product-showcase-carousel .swiper-button-prev:hover{background-color:#fff}
.bce-product-showcase-carousel .swiper-button-prev{left:13px}
.bce-product-showcase-carousel .swiper-button-next{right:13px}
.bce-product-showcase-carousel .swiper-button-disabled{opacity:0!important;pointer-events:none}
.bce-product-showcase-carousel .swiper-button-next:after,.bce-product-showcase-carousel .swiper-button-prev:after{font-size:20px;font-weight:700}

/**
 * =================================================================
 * SECTION 2: PRODUCT CARD STYLING
 * =================================================================
 */
.product-card{background-color:#fff;width:100%;display:flex;flex-direction:column;border:1px solid #e9e9e9;border-radius:8px;overflow:hidden;transition:transform .3s ease-in-out,box-shadow .3s ease-in-out;height:100%}
.product-card:hover{transform:translateY(-8px);box-shadow:0 8px 25px rgba(0,0,0,.15)}
.product-card .product-image-link{display:block;position:relative;overflow:hidden}
.product-card .product-image-link img{display: block;width: 100%;height: 100%;aspect-ratio: 1/1;object-fit: cover;padding: 0;}
.product-card .product-details{padding:13px;text-align:left;display:flex;flex-direction:column;flex-grow:1}
.product-card .product-title{font-size:13px;font-weight:500;line-height:1.4;color:#222;margin-bottom:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.product-card .product-title a{color:inherit;text-decoration:none}
.product-card .product-short-description{font-size:14px;line-height:1.5;color:#666;margin-bottom:10px;min-height:calc(1.5em * 2);overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.product-card .product-price{font-size:13px;font-weight:700;color:#111;margin-top:auto}

/**
 * =================================================================
 * SECTION 3: HOVER ACTIONS & BUTTON STYLING (REFACTORED)
 * =================================================================
 */
.product-hover-actions{position:absolute;bottom:13px;left:50%;width:90%;display:flex;justify-content:center;opacity:0;transition:opacity .3s ease,transform .3s ease;transform:translateY(10px) translateX(-50%);pointer-events:none}
.product-card:hover .product-hover-actions{opacity:1;transform:translateY(0) translateX(-50%);pointer-events:auto}
.bce-action-button {background-color:rgba(28,28,28,.9);color:#fff;border:none;padding:12px 24px;cursor:pointer;font-size:14px;font-weight:500;border-radius:6px;text-align:center;width:auto;display:inline-block;line-height:1;transition:background-color .2s ease;text-decoration: none;}
.bce-action-button:hover {background-color:rgba(80,80,80,.85);color: #fff;}

/**
 * =================================================================
 * SECTION 4: QUICK VIEW MODAL
 * =================================================================
 */
body.bce-modal-open{overflow:hidden}

/* SỬA LỖI 2: Thay đổi cách hoạt động của modal */
.bce-quick-view-modal-container{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    z-index:10000;
    display:flex; /* Luôn là flex để căn giữa */
    align-items:center;
    justify-content:center;
    opacity:0;
    visibility:hidden; /* Dùng visibility thay cho display:none */
    transition:opacity .3s ease, visibility 0s .3s;
    pointer-events: none; /* Vô hiệu hóa click khi ẩn */
}
.bce-quick-view-modal-container.is-visible{
    opacity:1;
    visibility:visible;
    transition-delay:0s;
    pointer-events: auto; /* Kích hoạt lại click khi hiện */
}

.bce-modal-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.6);cursor:pointer}
.bce-modal-content{position:relative;background-color:#fff;width:90%;max-width:800px;max-height:90vh;border-radius:8px;box-shadow:0 10px 30px rgba(0,0,0,.2);display:flex;flex-direction:column;transform:scale(.95);transition:transform .3s ease}
.bce-quick-view-modal-container.is-visible .bce-modal-content{transform:scale(1)}
.bce-modal-close-button{position: fixed;top: 20px;right: 25px;background: transparent;border: none;font-size: 40px;line-height: 1;cursor: pointer;color: #fff;z-index: 10001;padding: 5px;font-weight: 300;text-shadow: 0 1px 3px rgba(0,0,0,0.4);}
.bce-modal-close-button:hover{color:#eee}
.bce-modal-body{padding:30px 40px;overflow-y:auto}
.bce-modal-loading-spinner{border:4px solid #f3f3f3;border-top:4px solid #3498db;border-radius:50%;width:40px;height:40px;animation:spin 1s linear infinite;margin:80px auto}
@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
.bce-quick-view-inner.layout-new{display:grid;grid-template-columns:40% 1fr;gap:30px;align-items:start}
.qv-left-column,.qv-right-column{display:flex;flex-direction:column}
.qv-right-column{justify-content:space-between;min-height:100%}
.qv-left-column .bce-quick-view-gallery img{border-radius:8px;width:100%;height:auto}
.qv-reviews{margin-top:15px}
.qv-reviews .star-rating{float:none;display:inline-block;margin-right:5px;vertical-align:middle}
.qv-reviews .woocommerce-review-link{color:#666;font-size:14px;text-decoration:none;vertical-align:middle}
.qv-reviews .woocommerce-review-link:hover{text-decoration:underline}
.qv-right-column .qv-product-details{margin-bottom:20px;flex-grow:1}
.qv-product-title{font-size:22px;font-weight:600;line-height:1.3;margin-top:0;margin-bottom:8px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.qv-short-description{font-size:15px;line-height:1.5;color:#555;margin-bottom:15px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical}
.qv-description{font-size:15px;line-height:1.6;color:#333;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}
.variations_form{margin-top:auto}
.variations_form .label{font-weight:600;text-transform:capitalize;margin-bottom:8px;display:block;font-size:14px}
.variations_form .swatch-list{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}
.variations_form .swatch{min-width:40px;height:40px;padding:0 10px;border:1px solid #ccc;border-radius:4px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-size:14px;transition:all .2s ease;background-color:#fff}
.variations_form .swatch.selected,.variations_form .swatch:hover{border-color:#111;background-color:#111;color:#fff}
.qv-price-actions-wrapper{margin-top:20px;border-top:1px solid #eee;padding-top:20px}
.qv-price-actions-wrapper .price{font-size:24px;font-weight:700;color:#c00;margin-bottom:20px}
.qv-actions-group{display:flex;align-items:center;gap:10px}
.qv-actions{display:flex;border-radius:99px;overflow:hidden;height:44px;background-color:#c00;border:1px solid #c00}
.qv-actions select.qty{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#c00;color:#fff;border:none;padding:0 15px;font-size:16px;cursor:pointer;border-right:1px solid #fff;background-image:url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' 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 8px center;background-size:1em;padding-right:30px;height:100%}
.qv-actions select.qty:focus{outline:none}
.qv-actions select.qty option{color:#000;background-color:#fff}
.qv-actions .add-to-cart-btn{background-color:#c00;color:#fff;border:none;border-radius:0;padding:12px 24px;font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap;height:100%;display:flex;align-items:center;transition:background-color .2s}
.qv-actions .add-to-cart-btn:hover{background-color:#d92323}
.qv-actions-group .bce-wishlist-button{width:44px;height:44px;border:1px solid #ccc;border-radius:50%;display:flex;align-items:center;justify-content:center;background:transparent;cursor:pointer;padding:0;transition:background-color .2s,border-color .2s}
.qv-actions-group .bce-wishlist-button:hover{background-color:#f0f0f0;border-color:#aaa}
.qv-actions-group .bce-wishlist-button.is-favorited{border-color:#c00;background-color:#fce8ec}
.qv-actions-group .bce-wishlist-button svg{width:24px;height:24px;transition:all .2s}
.qv-actions-group .bce-wishlist-button svg path{stroke:#333}
.qv-actions-group .bce-wishlist-button.is-favorited svg path{stroke:#c00;fill:#c00}

/**
 * =================================================================
 * SECTION 5: RESPONSIVE STYLES
 * =================================================================
 */
@media (max-width:768px){
    .bce-modal-content{width:100%;max-width:100%;height:95vh;max-height:95vh;border-radius:15px 15px 0 0;position:fixed;bottom:0;top:auto;animation:slide-up .3s ease-out}
    @keyframes slide-up{from{transform:translateY(100%)}to{transform:translateY(0)}}
    .bce-modal-body{padding:20px}
    .bce-quick-view-inner.layout-new{grid-template-columns:1fr}
    .qv-left-column{margin-bottom:20px}
    .product-hover-actions {display: none !important;}
}
.qv-actions .quantity {width: 70px;flex-shrink: 0;position: relative;border-right: 1px solid rgba(255, 255, 255, 0.4);}
.qv-actions .quantity .input-text.qty {width: 100%;height: 100%;background: transparent;border: none;color: white;text-align: center;font-weight: bold;font-size: 16px;box-sizing: border-box;padding: 0 5px;}
.qv-actions .single_add_to_cart_button {flex-grow: 1;display: flex;justify-content: center;}
.variations_form .swatch.swatch-image {padding: 2px;min-width: 44px;height: 44px;box-sizing: border-box;}
.variations_form .swatch.swatch-image img {width: 100%;height: 100%;display: block;object-fit: cover;border-radius: 2px;}
.variations_form .swatch.swatch-image.selected {border-width: 2px;border-color: #111;}

/**
 * =================================================================
 * SECTION 6: GLOBAL NOTIFICATION SYSTEM (ADDED IN PHASE 3)
 * =================================================================
 */
#bce-global-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #2c3e50;
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    font-size: 15px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#bce-global-notification.visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

#bce-global-notification.error {
    background-color: #e74c3c; /* Màu đỏ cho lỗi */
}

#bce-global-notification.success {
    background-color: #2ecc71; /* Màu xanh cho thành công */
}

/**
 * =================================================================
 * SECTION 7: SỬA LỖI GHI ĐÈ STYLE NÚT BỞI ELEMENTOR
 * =================================================================
 */
body .bce-quick-view-modal-container .bce-quick-view-inner form.cart button.single_add_to_cart_button {
    background-color: #cc0000 !important;
    color: #ffffff !important;
    border: 1px solid #cc0000 !important;
}

body .bce-quick-view-modal-container .bce-quick-view-inner form.cart button.single_add_to_cart_button:hover {
    background-color: #e60000 !important; /* Làm màu đỏ sáng hơn một chút khi hover */
    color: #ffffff !important;
    border-color: #e60000 !important;
}

/**
 * =================================================================
 * SECTION 8: SỬA LỖI VIỀN ĐEN KHI FOCUS
 * =================================================================
 */
body .bce-quick-view-modal-container .qv-actions .quantity .input-text.qty:focus,
body .bce-quick-view-modal-container .qv-actions .single_add_to_cart_button:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.25) !important; /* Thay thế outline bằng một box-shadow tinh tế */
}


/**
 * =================================================================
 * SECTION 9: TÍCH HỢP NÚT YÊU THÍCH VÀO POPUP XEM NHANH (Bỏ vòng tròn)
 * =================================================================
 */
.bce-quick-view-inner .qv-actions-group .bce-quick-view-wishlist-button {
    /* Thiết lập chung */
    width: auto; /* Tự động điều chỉnh độ rộng */
    height: 44px; /* Giữ chiều cao để thẳng hàng */
    border: none; /* << BỎ VIỀN */
    border-radius: 0; /* << BỎ BO TRÒN */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent; /* << BỎ MÀU NỀN */
    cursor: pointer;
    padding: 0 10px; /* Thêm padding trái phải cho dễ click */
    margin-left: 5px; 
    transition: all 0.2s ease;
    line-height: 1;

    /* Thiết lập cho icon SVG bên trong */
    fill: none; 
    color: #333; 
}

/* Hiệu ứng khi di chuột */
.bce-quick-view-inner .qv-actions-group .bce-quick-view-wishlist-button:hover {
    background-color: transparent; /* << ĐẢM BẢO KHÔNG CÓ NỀN KHI HOVER */
    color: #d90429;
}

/* Trạng thái đã trong danh sách yêu thích */
.bce-quick-view-inner .qv-actions-group .bce-quick-view-wishlist-button.is-in-wishlist {
    border-color: transparent; /* << BỎ VIỀN */
    color: #d90429;
    fill: #d90429;
}
.bce-quick-view-inner .qv-actions-group .bce-quick-view-wishlist-button.is-in-wishlist:hover {
    background-color: transparent; /* << ĐẢM BẢO KHÔNG CÓ NỀN KHI HOVER */
}

/* Trạng thái đang tải */
.bce-quick-view-inner .qv-actions-group .bce-quick-view-wishlist-button.loading {
    opacity: 0.5;
    cursor: wait;
    pointer-events: none;
}

.bce-quick-view-inner .qv-actions-group .bce-quick-view-wishlist-button svg {
    width: 24px;
    height: 24px;
}

/**
 * =================================================================
 * SECTION 10: GHI ĐÈ STYLE NÚT "XEM NHANH" (CUSTOM)
 * =================================================================
 * Sử dụng selector có độ ưu tiên cao và !important để thắng các style
 * từ Elementor hoặc theme.
 */

.bce-product-showcase-wrapper .product-card .product-hover-actions .bce-action-button.bce-quick-view-button {
    background-color: rgba(0, 0, 0, 0.7) !important; /* Nền đen, trong suốt 70% */
    color: #ffffff !important; /* Chữ màu trắng */
    border: none !important;
    border-radius: 6px;
    padding: 10px 20px; /* Có thể điều chỉnh padding nếu cần */
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

/* Tùy chỉnh hiệu ứng khi di chuột qua */
.bce-product-showcase-wrapper .product-card .product-hover-actions .bce-action-button.bce-quick-view-button:hover {
    background-color: rgba(0, 0, 0, 0.9) !important; /* Nền đen hơn khi hover */
    color: #ffffff !important;
}
/**
 * =================================================================
 * SECTION 11: SỬA LỖI GIAO DIỆN SÁT LỀ TRÊN MOBILE
 * =================================================================
 */
@media (max-width: 768px) {
    .bce-product-showcase-wrapper {
        padding-left: 15px;
        padding-right: 15px;
        box-sizing: border-box; /* Đảm bảo padding không làm vỡ layout */
    }
}

/**
 * =================================================================
 * SECTION 12: SỬA LỖI 1 - GIAO DIỆN NÚT ADD TO CART BỊ VỠ
 * =================================================================
 * Ẩn liên kết "Xem giỏ hàng" do WooCommerce tự động thêm vào sau khi
 * thêm sản phẩm thành công để tránh phá vỡ bố cục.
 */
.bce-quick-view-modal-container .variations_form .added_to_cart {
    display: none !important;
}