/* ============================================================
   WaBanja Global Modern Toast Notification System (Middle Pop-up)
   (C) 2026 Dafri Apps Dev (PTY) LTD. All rights reserved.
   ============================================================ */

/* --- Container (Centered Middle Pop-up) -------------------- */
#wb-toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    pointer-events: none;
    width: max-content;
    max-width: min(92vw, 520px);
}

/* --- Base Toast Capsule ------------------------------------ */
.wb-toast {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px 12px 14px;
    min-height: 52px;
    border-radius: 9999px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    backdrop-filter: blur(32px) saturate(200%);
    -webkit-backdrop-filter: blur(32px) saturate(200%);
    box-shadow:
        0 24px 64px -6px rgba(15, 23, 42, 0.28),
        0 8px 24px -2px rgba(15, 23, 42, 0.14),
        inset 0 1.5px 1.5px rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    cursor: default;
    user-select: none;
    max-width: min(92vw, 520px);

    /* Start state: centered, scaled down & blurred */
    opacity: 0;
    transform: scale(0.82) translateY(12px);
    filter: blur(8px);
    transition:
        opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 0.32s ease;
    will-change: transform, opacity, filter;
}

/* --- Enter / Visible State (Spring Middle Pop-up) ----------- */
.wb-toast--visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0px);
}

/* --- Leaving / Dismiss State (Folds Away) ------------------- */
.wb-toast--leaving {
    opacity: 0;
    transform: scale(0.88) translateY(-10px);
    filter: blur(8px);
    transition:
        opacity 0.22s ease-in,
        transform 0.22s cubic-bezier(0.4, 0, 1, 1),
        filter 0.22s ease-in;
}

/* --- Type Variants: Success --------------------------------- */
.wb-toast--success {
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow:
        0 18px 48px -4px rgba(16, 185, 129, 0.22),
        0 6px 18px -2px rgba(15, 23, 42, 0.1),
        inset 0 1.5px 1.5px rgba(255, 255, 255, 0.9);
}
.wb-toast--success .wb-toast__icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}
.wb-toast--success .wb-toast__label { color: #059669; }
.wb-toast--success .wb-toast__progress { background: linear-gradient(90deg, #10b981, #34d399); }

/* --- Type Variants: Warning --------------------------------- */
.wb-toast--warning {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow:
        0 18px 48px -4px rgba(245, 158, 11, 0.2),
        0 6px 18px -2px rgba(15, 23, 42, 0.1),
        inset 0 1.5px 1.5px rgba(255, 255, 255, 0.9);
}
.wb-toast--warning .wb-toast__icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}
.wb-toast--warning .wb-toast__label { color: #d97706; }
.wb-toast--warning .wb-toast__progress { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

/* --- Type Variants: Error ----------------------------------- */
.wb-toast--error {
    border-color: rgba(244, 63, 94, 0.4);
    box-shadow:
        0 18px 48px -4px rgba(244, 63, 94, 0.25),
        0 6px 18px -2px rgba(15, 23, 42, 0.1),
        inset 0 1.5px 1.5px rgba(255, 255, 255, 0.9);
}
.wb-toast--error .wb-toast__icon {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.45);
}
.wb-toast--error .wb-toast__label { color: #e11d48; }
.wb-toast--error .wb-toast__progress { background: linear-gradient(90deg, #f43f5e, #fb7185); }

/* --- Type Variants: Info ------------------------------------ */
.wb-toast--info {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow:
        0 18px 48px -4px rgba(99, 102, 241, 0.2),
        0 6px 18px -2px rgba(15, 23, 42, 0.1),
        inset 0 1.5px 1.5px rgba(255, 255, 255, 0.9);
}
.wb-toast--info .wb-toast__icon {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.wb-toast--info .wb-toast__label { color: #4f46e5; }
.wb-toast--info .wb-toast__progress { background: linear-gradient(90deg, #6366f1, #818cf8); }

/* --- Icon Badge -------------------------------------------- */
.wb-toast__icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wb-toast__icon svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
}

/* --- Body -------------------------------------------------- */
.wb-toast__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
}
.wb-toast__label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.2;
}
.wb-toast__msg {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
    color: inherit;
}

/* --- Close Button ------------------------------------------ */
.wb-toast__close {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 4px;
    flex-shrink: 0;
    transition: opacity 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.wb-toast__close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1.1);
}
.wb-toast__close svg {
    width: 14px;
    height: 14px;
}

/* --- Progress Bar ------------------------------------------ */
.wb-toast__progress {
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 2.5px;
    border-radius: 2px;
    width: calc(100% - 40px);
    transition: width linear;
}

/* ============================================================
   Dark Mode Overrides
   ============================================================ */
:is(html[data-theme="dark"], body[data-theme="dark"], html.dark, html.dark-theme, body.dark-mode, [data-bs-theme="dark"]) .wb-toast {
    background: rgba(18, 20, 32, 0.95);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow:
        0 28px 70px -6px rgba(0, 0, 0, 0.75),
        0 10px 28px -2px rgba(0, 0, 0, 0.45),
        inset 0 1px 1.5px rgba(255, 255, 255, 0.25);
}
:is(html[data-theme="dark"], body[data-theme="dark"], html.dark, html.dark-theme, body.dark-mode, [data-bs-theme="dark"]) .wb-toast--success .wb-toast__label { color: #34d399; }
:is(html[data-theme="dark"], body[data-theme="dark"], html.dark, html.dark-theme, body.dark-mode, [data-bs-theme="dark"]) .wb-toast--warning .wb-toast__label { color: #fbbf24; }
:is(html[data-theme="dark"], body[data-theme="dark"], html.dark, html.dark-theme, body.dark-mode, [data-bs-theme="dark"]) .wb-toast--error .wb-toast__label { color: #fb7185; }
:is(html[data-theme="dark"], body[data-theme="dark"], html.dark, html.dark-theme, body.dark-mode, [data-bs-theme="dark"]) .wb-toast--info .wb-toast__label { color: #67e8f9; }
:is(html[data-theme="dark"], body[data-theme="dark"], html.dark, html.dark-theme, body.dark-mode, [data-bs-theme="dark"]) .wb-toast__close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.wb-toast--credit {
    border-color: rgba(255, 184, 0, 0.4);
    box-shadow:
        0 18px 48px -4px rgba(255, 184, 0, 0.25),
        0 6px 18px -2px rgba(15, 23, 42, 0.1),
        inset 0 1.5px 1.5px rgba(255, 255, 255, 0.9);
}
.wb-toast--credit .wb-toast__icon {
    background: linear-gradient(135deg, #FFAE00, #FF7A45);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 174, 0, 0.45);
}
.wb-toast--credit .wb-toast__label { color: #f59e0b; }
.wb-toast--credit .wb-toast__progress { background: linear-gradient(90deg, #FFAE00, #FF3D77); }

:is(html[data-theme="dark"], body[data-theme="dark"], html.dark, html.dark-theme, body.dark-mode, [data-bs-theme="dark"]) .wb-toast--credit .wb-toast__label { color: #fbbf24; }

/* ============================================================
   Modern Center Confirm & Alert Dialog (WBConfirm / WBAlert)
   ============================================================ */
.wb-confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000005;
    background: rgba(5, 7, 14, 0.78);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}
.wb-confirm-backdrop--visible {
    opacity: 1;
}
.wb-confirm-modal {
    position: relative;
    width: 100%;
    max-width: 460px;
    border-radius: 26px;
    border: 1.5px solid transparent !important;
    background-image: linear-gradient(165deg, rgba(24, 27, 44, 0.94) 0%, rgba(13, 15, 26, 0.98) 100%), linear-gradient(135deg, rgba(255, 61, 119, 0.5) 0%, rgba(155, 92, 255, 0.5) 100%) !important;
    background-origin: padding-box, border-box !important;
    background-clip: padding-box, border-box !important;
    color: #f8fafc;
    box-shadow:
        0 35px 85px -10px rgba(0, 0, 0, 0.8),
        0 12px 30px -4px rgba(255, 61, 119, 0.25),
        inset 0 1px 1.5px rgba(255, 255, 255, 0.25);
    padding: 30px 28px 26px;
    transform: scale(0.86);
    filter: blur(6px);
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
    text-align: center;
}
html:not(.dark):not([data-theme="dark"]) .wb-confirm-modal {
    background-image: linear-gradient(165deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 247, 255, 0.98) 100%), linear-gradient(135deg, rgba(255, 61, 119, 0.4) 0%, rgba(155, 92, 255, 0.4) 100%) !important;
    color: #0f172a;
    box-shadow:
        0 32px 80px -10px rgba(15, 23, 42, 0.28),
        0 12px 30px -4px rgba(15, 23, 42, 0.14),
        inset 0 1.5px 1.5px rgba(255, 255, 255, 0.9);
}
.wb-confirm-backdrop--visible .wb-confirm-modal {
    transform: scale(1);
    filter: blur(0px);
}
.wb-confirm-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 18px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 61, 119, 0.2), rgba(155, 92, 255, 0.25));
    color: #FF3D77;
    border: 1.5px solid rgba(255, 61, 119, 0.35);
    box-shadow: 0 10px 28px -4px rgba(255, 61, 119, 0.35);
}
.wb-confirm-icon svg {
    width: 28px;
    height: 28px;
}
.wb-confirm-icon--credit {
    background: linear-gradient(135deg, rgba(255, 174, 0, 0.22), rgba(255, 61, 119, 0.25));
    color: #FFAE00;
    border-color: rgba(255, 174, 0, 0.45);
    box-shadow: 0 10px 28px -4px rgba(255, 174, 0, 0.4);
}
.wb-confirm-icon--danger {
    background: linear-gradient(135deg, rgba(255, 77, 109, 0.2), rgba(225, 29, 72, 0.3));
    color: #ff4d6d;
    border-color: rgba(255, 77, 109, 0.35);
    box-shadow: 0 8px 24px -4px rgba(225, 29, 72, 0.35);
}
.wb-confirm-icon--info {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(99, 102, 241, 0.25));
    color: #00F0FF;
    border-color: rgba(0, 240, 255, 0.35);
    box-shadow: 0 8px 24px -4px rgba(0, 240, 255, 0.3);
}
.wb-confirm-icon--warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 8px 24px -4px rgba(245, 158, 11, 0.3);
}
.wb-confirm-icon--success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3));
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 8px 24px -4px rgba(16, 185, 129, 0.3);
}
.wb-confirm-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    margin: 0 0 10px;
    line-height: 1.3;
}
.wb-confirm-msg {
    font-size: 0.92rem;
    line-height: 1.55;
    opacity: 0.85;
    margin: 0 0 26px;
}
.wb-confirm-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: stretch;
}
.wb-confirm-btn {
    flex: 1;
    min-height: 46px;
    padding: 12px 22px;
    border-radius: 9999px;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    border: 0;
    transition: transform 0.18s cubic-bezier(.16,1,.3,1), box-shadow 0.18s ease, filter 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.2px;
}
.wb-confirm-btn:active {
    transform: scale(0.97);
}
.wb-confirm-btn--cancel {
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.16);
}
html:not(.dark):not([data-theme="dark"]) .wb-confirm-btn--cancel {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}
.wb-confirm-btn--cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}
html:not(.dark):not([data-theme="dark"]) .wb-confirm-btn--cancel:hover {
    background: #e2e8f0;
}
.wb-confirm-btn--danger {
    background: linear-gradient(135deg, #ff4d6d, #e11d48);
    color: #ffffff;
    box-shadow: 0 8px 24px -2px rgba(225, 29, 72, 0.5);
}
.wb-confirm-btn--danger:hover {
    box-shadow: 0 12px 30px -2px rgba(225, 29, 72, 0.65);
    filter: brightness(1.08);
    transform: translateY(-1px);
}
.wb-confirm-btn--primary {
    background: linear-gradient(135deg, #FF5F6D 0%, #FFC371 100%);
    color: #ffffff;
    box-shadow: 0 8px 24px -2px rgba(255, 95, 109, 0.5);
}
.wb-confirm-btn--primary:hover {
    box-shadow: 0 12px 32px -2px rgba(255, 61, 119, 0.65);
    filter: brightness(1.08);
    transform: translateY(-1px);
}
.wb-confirm-btn--credit {
    background: linear-gradient(135deg, #FF3D77 0%, #FF7A45 45%, #FFAE00 100%);
    color: #ffffff;
    box-shadow: 0 8px 24px -2px rgba(255, 122, 69, 0.5);
}
.wb-confirm-btn--credit:hover {
    box-shadow: 0 12px 32px -2px rgba(255, 122, 69, 0.65);
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .wb-toast, .wb-toast--visible, .wb-toast--leaving,
    .wb-confirm-backdrop, .wb-confirm-modal {
        transition: none !important;
        transform: none !important;
        filter: none !important;
    }
}
