/* =========================================================================
   POPUP SYSTEM - CSS
   -------------------------------------------------------------------------
   CSS cho hệ thống popup trên trang sản phẩm đơn:
   - Popup mô tả dưới giá
   - 3 popup ưu đãi (uu-dai-1, uu-dai-2, uu-dai-3)
   - 3 popup chính sách (trả góp, bảo hành, đổi trả)

   PHP tương ứng: functions.php
     - render_popup_mo_ta_duoi_gia()
     - render_custom_uu_dai_popups()
     - render_custom_chinh_sach_popups()
     - toannhan_enqueue_popup_assets()  (hàm enqueue file này)

   Lịch sử:
   - 2026-04-17: Tách ra đây từ inline trong custom_popup_styles()
     để tối ưu tốc độ (chỉ load trên is_product() thay vì mọi trang)
     và cho phép browser cache.
   ========================================================================= */

/* Overlay */
.custom-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 9999;
}

/* Luôn ẩn nếu KHÔNG active (chặn CSS ngoài đè display:block) */
.custom-popup:not(.active) {
    display: none !important;
}

/* Khi mở -> bật flex và căn giữa chắc chắn */
.custom-popup.active {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

/* Hộp nội dung */
.custom-popup-inner {
    background: #fff;
    width: 90%;
    max-width: 1200px;
    max-height: 60vh;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
    margin: 0 !important;
    /* chặn margin lạ */
}

/* Wrapper nội dung */
.popup-content-wrapper {
    overflow-y: auto;
    padding: 30px;
    flex: 1;
}

/* Nút đóng: dùng absolute để neo cố định góc phải */
.custom-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease;
}

.custom-popup-close:hover {
    transform: scale(1.15);
}

.custom-popup-close svg {
    pointer-events: none;
}

/* (Tuỳ chọn) chặn scroll body khi popup mở - hỗ trợ iOS */
html.popup-open,
body.popup-open {
    overflow: hidden !important;
}
