﻿/**
 * Notify — global toast + modal alert + confirm system.
 * Drop-in replacement for native alert() / confirm() with on-brand styling.
 */

/* ===== Container for stacked toasts ===== */
.notify-stack {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: calc(100vw - 48px);
}
@media (max-width: 600px) {
  .notify-stack { top: 12px; right: 12px; left: 12px; }
}

/* ===== Toast ===== */
.notify-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  padding: 14px 16px 14px 14px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  position: relative;
  overflow: hidden;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.92rem;
  color: #0f172a;
  animation: notify-slide-in 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  transform-origin: top right;
}
.notify-toast.is-leaving {
  animation: notify-slide-out 0.22s ease-in forwards;
}
@keyframes notify-slide-in {
  from { opacity: 0; transform: translateX(20px) scale(0.98); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes notify-slide-out {
  to { opacity: 0; transform: translateX(20px) scale(0.97); }
}

.notify-toast-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: white;
  font-weight: 700;
}
.notify-toast-body { flex: 1; min-width: 0; padding-top: 2px; }
.notify-toast-title {
  font-weight: 700;
  font-size: 0.96rem;
  margin: 0 0 2px;
  line-height: 1.35;
  word-wrap: break-word;
}
.notify-toast-msg {
  color: #475569;
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 0;
  word-wrap: break-word;
}
.notify-toast-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: all 0.15s;
}
.notify-toast-close:hover { background: #f1f5f9; color: #0f172a; }

/* Color accent strip */
.notify-toast::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--notify-accent, #dc2626);
}
.notify-toast.is-success { --notify-accent: #10b981; }
.notify-toast.is-success .notify-toast-icon { background: linear-gradient(135deg, #10b981, #059669); }
.notify-toast.is-error { --notify-accent: #ef4444; }
.notify-toast.is-error .notify-toast-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }
.notify-toast.is-warning { --notify-accent: #f59e0b; }
.notify-toast.is-warning .notify-toast-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.notify-toast.is-info { --notify-accent: #3b82f6; }
.notify-toast.is-info .notify-toast-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); }

/* Progress bar (auto-dismiss) */
.notify-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--notify-accent, #dc2626);
  opacity: 0.4;
  transform-origin: left;
  animation: notify-progress linear forwards;
}
@keyframes notify-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ===== Modal (alert / confirm) ===== */
.notify-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: notify-fade-in 0.15s ease-out;
}
.notify-backdrop.is-leaving { animation: notify-fade-out 0.12s ease-in forwards; }
@keyframes notify-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes notify-fade-out { to { opacity: 0; } }

.notify-modal {
  background: white;
  border-radius: 18px;
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.4);
  animation: notify-pop 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
@keyframes notify-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.notify-modal-head {
  padding: 28px 28px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.notify-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin-bottom: 14px;
  color: white;
  background: linear-gradient(135deg, #dc2626, #475569);
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35);
  position: relative;
}
.notify-modal-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.15;
  z-index: -1;
  filter: blur(8px);
}
.notify-modal.is-success .notify-modal-icon { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35); }
.notify-modal.is-error .notify-modal-icon,
.notify-modal.is-danger .notify-modal-icon { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35); }
.notify-modal.is-warning .notify-modal-icon { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35); }
.notify-modal.is-info .notify-modal-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35); }
.notify-modal.is-question .notify-modal-icon { background: linear-gradient(135deg, #475569, #dc2626); box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35); }

.notify-modal-title {
  font-family: 'Plus Jakarta Sans', 'Be Vietnam Pro', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.notify-modal-msg {
  color: #475569;
  font-size: 0.94rem;
  line-height: 1.55;
  margin: 0;
  padding: 0 12px;
  white-space: pre-line;
  word-wrap: break-word;
}
.notify-modal-input-wrap { padding: 16px 28px 0; }
.notify-modal-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.94rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.notify-modal-input:focus {
  outline: none;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.notify-modal-actions {
  display: flex;
  gap: 10px;
  padding: 24px 28px 26px;
  margin-top: 22px;
}
.notify-modal-actions .notify-btn {
  flex: 1;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.notify-btn-cancel {
  background: white;
  color: #475569;
  border-color: #e5e7eb;
}
.notify-btn-cancel:hover { background: #f8fafc; color: #0f172a; }
.notify-btn-primary {
  background: linear-gradient(135deg, #dc2626, #475569);
  color: white;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.32);
}
.notify-btn-primary:hover {
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.45);
  transform: translateY(-1px);
}
.notify-btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.32);
}
.notify-btn-danger:hover {
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.45);
  transform: translateY(-1px);
}
.notify-btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.32);
}
.notify-btn-success:hover { box-shadow: 0 8px 20px rgba(16, 185, 129, 0.45); transform: translateY(-1px); }
.notify-btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.32);
}
.notify-btn-warning:hover { box-shadow: 0 8px 20px rgba(245, 158, 11, 0.45); transform: translateY(-1px); }
