/* ==========================================================================
   HuyMMO Modern Alert Popup System (Modal Replacement for Floating Toasts)
   ========================================================================== */

/* Hide legacy floating toasts and flash messages */
.flash-message.temporary,
#accToastContainer,
#toastContainer,
.toast-container,
.acc-toast,
.vs-toast,
.toast-msg,
.toast:not(.keep-visible) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Modal Popup Overlay */
.app-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483640;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(5, 10, 20, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-popup-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Modal Popup Card */
.app-popup-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #0d1527;
    background: linear-gradient(165deg, rgba(17, 27, 49, 0.98) 0%, rgba(10, 18, 34, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    padding: 30px 24px 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75),
                0 0 0 1px rgba(255, 255, 255, 0.05),
                0 0 40px rgba(112, 71, 235, 0.12);
    text-align: center;
    transform: scale(0.92) translateY(16px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease;
    overflow: hidden;
}

.app-popup-overlay.active .app-popup-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Light theme support */
body:not(.ai-future-theme) .app-popup-card {
    background: #ffffff;
    border: 1px solid rgba(24, 24, 27, 0.1);
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Close Button */
.app-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 2;
}

body:not(.ai-future-theme) .app-popup-close {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.08);
    color: #64748b;
}

.app-popup-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: scale(1.08);
}

body:not(.ai-future-theme) .app-popup-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #0f172a;
}

/* Icon Badge */
.app-popup-icon-badge {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    font-size: 28px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: popupIconEntrance 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popupIconEntrance {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    60% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Success Type */
.app-popup-card.type-success .app-popup-icon-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1.5px solid rgba(16, 185, 129, 0.35);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.28);
}

/* Error Type */
.app-popup-card.type-error .app-popup-icon-badge,
.app-popup-card.type-danger .app-popup-icon-badge {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    border: 1.5px solid rgba(244, 63, 94, 0.35);
    box-shadow: 0 0 30px rgba(244, 63, 94, 0.28);
}

/* Warning Type */
.app-popup-card.type-warning .app-popup-icon-badge {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1.5px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.28);
}

/* Info Type */
.app-popup-card.type-info .app-popup-icon-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1.5px solid rgba(56, 189, 248, 0.35);
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.28);
}

/* Popup Title */
.app-popup-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 10px;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -0.2px;
}

body:not(.ai-future-theme) .app-popup-title {
    color: #0f172a;
}

/* Popup Message */
.app-popup-message {
    font-size: 14.5px;
    line-height: 1.6;
    color: #94a3b8;
    margin: 0 0 24px;
    word-break: break-word;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body:not(.ai-future-theme) .app-popup-message {
    color: #475569;
}

/* Action Buttons */
.app-popup-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.app-popup-btn {
    flex: 1;
    padding: 13px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14.5px;
    border: none;
    cursor: pointer;
    transition: all 0.22s ease;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.app-popup-btn:active {
    transform: scale(0.98);
}

.app-popup-btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #cbd5e1;
}

.app-popup-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

body:not(.ai-future-theme) .app-popup-btn-cancel {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
}

body:not(.ai-future-theme) .app-popup-btn-cancel:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Button colors by type */
.app-popup-card.type-success .app-popup-btn-confirm {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.app-popup-card.type-success .app-popup-btn-confirm:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45);
    transform: translateY(-1px);
}

.app-popup-card.type-error .app-popup-btn-confirm,
.app-popup-card.type-danger .app-popup-btn-confirm {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.35);
}

.app-popup-card.type-error .app-popup-btn-confirm:hover,
.app-popup-card.type-danger .app-popup-btn-confirm:hover {
    background: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.45);
    transform: translateY(-1px);
}

.app-popup-card.type-warning .app-popup-btn-confirm {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.app-popup-card.type-warning .app-popup-btn-confirm:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.45);
    transform: translateY(-1px);
}

.app-popup-card.type-info .app-popup-btn-confirm {
    background: linear-gradient(135deg, #7047eb 0%, #5b21b6 100%);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(112, 71, 235, 0.35);
}

.app-popup-card.type-info .app-popup-btn-confirm:hover {
    background: linear-gradient(135deg, #8b5cf6 0%, #7047eb 100%);
    box-shadow: 0 8px 24px rgba(112, 71, 235, 0.45);
    transform: translateY(-1px);
}

/* Subtle Progress Bar for Auto-dismiss */
.app-popup-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    opacity: 0.85;
    transform-origin: left;
}

.app-popup-card.type-success .app-popup-progress {
    background: #10b981;
}

.app-popup-card.type-error .app-popup-progress,
.app-popup-card.type-danger .app-popup-progress {
    background: #f43f5e;
}

.app-popup-card.type-warning .app-popup-progress {
    background: #f59e0b;
}

.app-popup-card.type-info .app-popup-progress {
    background: #7047eb;
}
