/* ==========================================================================
   MHEnt. UI LIBRARY - THE ULTIMATE ALERT, POPUP & MOBILE TOAST SYSTEM
   Đồng bộ giao diện MHEnt Universe cho MHEnt Workspace
   ========================================================================== */

/* ==========================================
   1. THÔNG BÁO NHANH (TOAST NOTIFICATION)
   ========================================== */
#mhent-toast-container {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.mhent-toast {
    pointer-events: auto;
    width: 320px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    border-left: 5px solid #10b981;
    animation: toastFadeInRight 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.mhent-toast.error { border-left-color: #ef4444; }
.mhent-toast.info { border-left-color: #3b82f6; }
.mhent-toast.warning { border-left-color: #f59e0b; }
.mhent-toast.success { border-left-color: #10b981; }

.mhent-toast-icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.mhent-toast-icon svg { width: 24px !important; height: 24px !important; display: block !important; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }

.mhent-toast-content { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.mhent-toast-title { font-weight: 800; color: #f8fafc; font-size: 14.5px; margin-bottom: 2px; }
.mhent-toast-desc { color: #94a3b8; font-size: 13px; font-weight: 600; line-height: 1.4; word-break: break-word; }

/* Light mode support */
body.light-mode .mhent-toast {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
body.light-mode .mhent-toast-title { color: #0f172a; }
body.light-mode .mhent-toast-desc { color: #475569; }

/* ==========================================
   2. BẢNG THÔNG BÁO Ở GIỮA (POPUP & CONFIRM)
   ========================================== */
.mhent-ui-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(9, 13, 22, 0.75); backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999998; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease-out;
}

.mhent-ui-overlay.show { opacity: 1; pointer-events: auto; }

.mhent-ui-box {
    background: var(--bg-surface, #0f172a);
    width: 90%; max-width: 400px; padding: 32px 28px;
    border-radius: 24px; text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.12));
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mhent-ui-overlay.show .mhent-ui-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.mhent-ui-overlay.out { opacity: 0; pointer-events: none; }
.mhent-ui-overlay.out .mhent-ui-box {
    transform: scale(0.9) translateY(10px);
    opacity: 0;
}

.mhent-ui-icon { margin-bottom: 16px; display: inline-block; padding: 14px; border-radius: 50%; }
.mhent-ui-box.success .mhent-ui-icon { background: rgba(16, 185, 129, 0.15); }
.mhent-ui-box.error .mhent-ui-icon { background: rgba(239, 68, 68, 0.15); }
.mhent-ui-box.warning .mhent-ui-icon { background: rgba(245, 158, 11, 0.15); }
.mhent-ui-icon svg { width: 44px !important; height: 44px !important; display: block !important; margin: 0 auto; }

.mhent-ui-title { font-size: 20px; font-weight: 900; color: var(--text-high, #f8fafc); margin: 0 0 8px 0; }
.mhent-ui-msg { font-size: 14px; color: var(--text-muted, #94a3b8); font-weight: 600; line-height: 1.6; margin: 0 0 22px 0; }

.mhent-ui-actions { display: flex; gap: 10px; justify-content: center; }
.mhent-ui-btn-primary, .mhent-ui-btn-outline {
    flex: 1; padding: 12px 18px; border-radius: 12px; font-weight: 800; font-size: 14px;
    cursor: pointer; transition: all 0.2s ease; border: none; outline: none;
}
.mhent-ui-btn-primary { background: linear-gradient(135deg, #6366f1, #a855f7); color: white; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35); }
.mhent-ui-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99, 102, 241, 0.45); }
.mhent-ui-btn-outline { background: var(--bg-surface-elevated, #1e293b); color: var(--text-medium, #cbd5e1); border: 1px solid var(--border-subtle, rgba(255,255,255,0.1)); }
.mhent-ui-btn-outline:hover { background: var(--bg-surface-hover, #334155); color: #ffffff; }

/* Light mode for popups */
body.light-mode .mhent-ui-box { background: #ffffff; border-color: rgba(0,0,0,0.1); box-shadow: 0 25px 50px rgba(0,0,0,0.15); }
body.light-mode .mhent-ui-title { color: #0f172a; }
body.light-mode .mhent-ui-msg { color: #64748b; }
body.light-mode .mhent-ui-btn-outline { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* ==========================================
   3. ANIMATIONS
   ========================================== */
@keyframes toastFadeInRight {
    0% { opacity: 0; transform: translateX(40px) scale(0.95); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastFadeOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.9) translateY(-20px); }
}

/* ==========================================
   4. RESPONSIVE MOBILE
   ========================================== */
@media (max-width: 480px) {
    #mhent-toast-container { top: 16px; left: 16px; right: 16px; }
    .mhent-toast { width: 100%; box-sizing: border-box; }
    .mhent-ui-box { padding: 24px 18px; }
    .mhent-ui-title { font-size: 18px; }
    .mhent-ui-actions { flex-direction: column; }
}
