/* ===========================
   WooCommerce Toast Notice
   CI: Black / White / Fragment Mono
=========================== */

/* ── Wrapper ─────────────────────────────────────────────────────
   Fixed toast position — ลบ margin / flex จาก CSS เดิม ออกทั้งหมด
   (ไม่ใช้ margin-bottom / display:flex / width:100%)
──────────────────────────────────────────────────────────────── */
.woocommerce-notices-wrapper {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: min(90vw, 640px);
    z-index: 999999;
    pointer-events: none;
}

.woocommerce-notices-wrapper > * {
    pointer-events: auto;
}

/* ── Notice Base — shared styles ─────────────────────────────────
   padding ซ้าย 58px เผื่อ icon (::before), ขวา 48px เผื่อปุ่มปิด
──────────────────────────────────────────────────────────────── */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {

    position: relative !important;

    padding: 18px 48px 18px 58px;

    /* CI: ขาว + ดำ */
    background: #fff;
    color: #000;
    border: 0 !important;
    outline: none !important;

    /* CI: Fragment Mono */
    font-family: 'Fragment Mono', monospace;
    font-size: 15px !important;

    border-radius: 3px;
    box-shadow: 0 8px 28px rgba(0,0,0,.12);
    overflow: hidden;

    /* Toast entrance animation */
    opacity: 0;
    transform: translateY(-18px);
    animation: toastShow .35s ease forwards;

}

/* ── woocommerce-message: grid 2col (text | button) ─────────────
   สำหรับ success notice ที่มี "View cart" button ชิดขวา
──────────────────────────────────────────────────────────────── */
.woocommerce-message {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 24px;
}

/* ── woocommerce-error / info: flex column — stack ทีละบรรทัด ───
   error เป็น <ul> มี <li> หลายอัน ใช้ flex-column ไม่งั้นจะ 2 คอลัมน์
──────────────────────────────────────────────────────────────── */
.woocommerce-error,
.woocommerce-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
    margin: 0;
}

/* ── Wrapper: stack multiple toasts vertically ───────────────────*/
.woocommerce-notices-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Check / Icon (::before) ─────────────────────────────────────
   position: absolute ให้อยู่นอก grid flow
──────────────────────────────────────────────────────────────── */
.woocommerce-message::before,
.woocommerce-error::before,
.woocommerce-info::before {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: #000;
}

/* ── Button (View cart / action) ─────────────────────────────────
   พลิกสี: ปุ่มขาว บน background ดำ
──────────────────────────────────────────────────────────────── */
.woocommerce-message .button,
.woocommerce-message a.button {
    float: none !important;
    margin: 0;
    white-space: nowrap;
    width: fit-content !important;
    border-radius: 3px;

    color: #fff !important;
    background: #000 !important;
    border: 1px solid #000 !important;
    padding: 12px 22px !important;
}

.woocommerce-message a.button:hover {
    color: #000 !important;
    background: #fff !important;
    border-color: #000 !important;
}

/* ── Progress Bar ────────────────────────────────────────────────
   AUTO-FADE ปิดชั่วคราว (animation-play-state: paused)
   ลบบรรทัด animation-play-state เพื่อเปิดใช้งาน
──────────────────────────────────────────────────────────────── */
.toast-progress {
    display: none;
}

/* ── Animations ──────────────────────────────────────────────────*/

@keyframes toastShow {
    to { opacity: 1; transform: translateY(0); }
}

.toast-hide {
    animation: toastHide .35s ease forwards;
}

@keyframes toastHide {
    to { opacity: 0; transform: translateY(-18px); }
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ── Close Button ─────────────────────────────────────────────── */

.toast-close {
    position: absolute;
    top: 10px;
    right: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;
    border-radius: 50%;

    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    color: #fff;

    color: #000;
    opacity: .5;
    background: rgba(0,0,0,.06);
    transition: opacity .2s, background .2s;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(0,0,0,.12);
}

/* ── Tablet (max-width: 1024px) ──────────────────────────────── */

@media (max-width: 1024px) {

    .woocommerce-message,
    .woocommerce-error,
    .woocommerce-info {
        column-gap: 20px;
        padding: 16px 44px 16px 52px;
    }

    .woocommerce-message::before,
    .woocommerce-error::before,
    .woocommerce-info::before {
        left: 18px;
    }

    .woocommerce-message .button,
    .woocommerce-message a.button {
        padding: 10px 18px !important;
        font-size: 14px;
    }

}

/* ── Mobile (max-width: 767px) ───────────────────────────────── */

@media (max-width: 767px) {

    .woocommerce-notices-wrapper {
        top: 15px;
        width: calc(100% - 24px);
    }

    .woocommerce-message {
        /* เปลี่ยนเป็น column — button อยู่ใต้ข้อความ */
        display: flex;
        flex-direction: column;
        align-items: stretch;

        padding: 16px 44px 16px 48px;
    }

    /* Icon ชิดบน ไม่ vertical center เมื่อข้อความ wrap หลายบรรทัด */
    .woocommerce-message::before,
    .woocommerce-error::before,
    .woocommerce-info::before {
        top: 18px;
        transform: none;
    }

    .woocommerce-message .button,
    .woocommerce-message a.button {
        margin-top: 10px;
        padding: 10px 16px !important;
        font-size: 14px;
        width: 100% !important;
        text-align: center;
    }

}
