/* ====================================================
   HỆ THỐNG POPUP VÀ TOAST THÔNG BÁO CAO CẤP (KHÔNG DÙNG ALERT())
   ==================================================== */

:root {
  --popup-bg: rgba(18, 24, 38, 0.96);
  --popup-card-bg: #161f30;
  --popup-border: rgba(255, 255, 255, 0.12);
  --popup-text: #f8fafc;
  --popup-muted: #94a3b8;
  --popup-success: #10b981;
  --popup-error: #ef4444;
  --popup-warning: #f59e0b;
  --popup-info: #3b82f6;
  --popup-radius: 18px;
}

/* Toast Container góc trên bên phải */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  width: calc(100% - 48px);
  pointer-events: none;
  font-family: 'Be Vietnam Pro', sans-serif;
}

/* Từng thẻ Toast */
.app-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: var(--popup-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--popup-text);
  border: 1px solid var(--popup-border);
  border-radius: var(--popup-radius);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  position: relative;
}

.app-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.app-toast-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.app-toast.success .app-toast-icon {
  background: rgba(16, 185, 129, 0.2);
  color: var(--popup-success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.app-toast.error .app-toast-icon {
  background: rgba(239, 68, 68, 0.2);
  color: var(--popup-error);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.app-toast.warning .app-toast-icon {
  background: rgba(245, 158, 11, 0.2);
  color: var(--popup-warning);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.app-toast.info .app-toast-icon {
  background: rgba(59, 130, 246, 0.2);
  color: var(--popup-info);
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.app-toast-body {
  flex: 1;
}

.app-toast-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  color: #fff;
}

.app-toast-msg {
  font-size: 13px;
  color: var(--popup-muted);
  line-height: 1.45;
}

.app-toast-close {
  background: none;
  border: none;
  color: var(--popup-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.app-toast-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Modal Popup Overlay */
.app-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 20, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  font-family: 'Be Vietnam Pro', sans-serif;
}

.app-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.app-modal-card {
  position: relative;
  background: var(--popup-card-bg);
  border: 1px solid var(--popup-border);
  border-radius: 22px;
  max-width: 480px;
  width: 100%;
  padding: 34px 30px 28px;
  box-shadow: 0 35px 70px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: scale(0.92) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

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

/* Nút Close (X) ở góc trên bên phải thẻ Popup */
.app-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--popup-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  transform: rotate(90deg);
}

/* Hiệu ứng rung nhẹ khi click ra ngoài overlay nhằm thông báo chỉ tắt qua icon close */
@keyframes popupShake {
  0%, 100% { transform: scale(1) translateX(0); }
  20%, 60% { transform: scale(1) translateX(-8px); }
  40%, 80% { transform: scale(1) translateX(8px); }
}

.app-modal-card.shake {
  animation: popupShake 0.4s ease;
}

.app-modal-icon-badge {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.app-modal-icon-badge.info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--popup-info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.app-modal-icon-badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--popup-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.app-modal-icon-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--popup-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.app-modal-icon-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--popup-error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.app-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.app-modal-desc {
  font-size: 14.5px;
  color: var(--popup-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.app-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.app-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.app-modal-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.app-modal-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.app-modal-btn-confirm {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.app-modal-btn-confirm:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.6);
  transform: translateY(-1px);
}

.app-modal-btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
}

.app-modal-btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  transform: translateY(-1px);
}
