/* ===================================================================
   AiTenderChat — Notify (toast + confirm) — iOS glass style
   =================================================================== */

.at-toast-stack {
  position: fixed;
  top: max(env(safe-area-inset-top, 0px), var(--sim-safe-top, 0px));
  left: 0; right: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  pointer-events: none;
}

.at-toast {
  position: relative;
  min-width: 260px;
  max-width: 480px;
  width: calc(100% - 24px);
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 16px;
  background: var(--at-glass-strong, rgba(255,255,255,.88));
  backdrop-filter: var(--at-glass-blur, saturate(180%) blur(20px));
  -webkit-backdrop-filter: var(--at-glass-blur, saturate(180%) blur(20px));
  border: 1px solid var(--at-glass-border, rgba(255,255,255,.6));
  border-radius: var(--at-r-lg, 22px);
  color: var(--at-text, #0f172a);
  box-shadow: var(--at-shadow-lg, 0 24px 60px rgba(15,23,42,.18));
  pointer-events: auto;
  overflow: hidden;
  cursor: pointer;
  animation: at-toast-in 320ms var(--at-ease-spring, cubic-bezier(.32,.72,0,1));
  will-change: transform, opacity;
}
[data-theme="dark"] .at-toast {
  background: rgba(28,28,30,.88);
  color: #f8fafc;
}

@keyframes at-toast-in {
  from { opacity: 0; transform: translateY(-110%) scale(.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}
.at-toast.closing { animation: at-toast-out 220ms var(--at-ease-out, cubic-bezier(.16,1,.3,1)) forwards; }
@keyframes at-toast-out {
  to { opacity: 0; transform: translateY(-110%) scale(.97); }
}

/* Accent bar on the left (color by kind) */
.at-toast::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--at-primary, #6366f1);
}
.at-toast.success::before { background: #10b981; }
.at-toast.error::before   { background: #ef4444; }
.at-toast.warning::before { background: #f59e0b; }
.at-toast.info::before    { background: #06b6d4; }

.at-toast-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(99,102,241,.12);
  color: var(--at-primary, #6366f1);
  flex-shrink: 0;
}
.at-toast.success .at-toast-icon { background: rgba(16,185,129,.14); color: #10b981; }
.at-toast.error .at-toast-icon   { background: rgba(239,68,68,.14);  color: #ef4444; }
.at-toast.warning .at-toast-icon { background: rgba(245,158,11,.14); color: #f59e0b; }
.at-toast.info .at-toast-icon    { background: rgba(6,182,212,.14);  color: #06b6d4; }
.at-toast-icon svg { width: 18px; height: 18px; }

.at-toast-body {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  word-break: break-word;
}
.at-toast-body .at-toast-title {
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.at-toast-close {
  border: none; background: transparent;
  color: var(--at-text-muted, #94a3b8);
  font-size: 18px; line-height: 1;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--at-dur-fast, 180ms);
}
.at-toast-close:hover { background: rgba(0,0,0,.06); }
[data-theme="dark"] .at-toast-close:hover { background: rgba(255,255,255,.08); }

/* Progress bar at bottom */
.at-toast-progress {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  background: currentColor;
  opacity: .35;
  width: 100%;
  transform-origin: left center;
  animation: at-toast-progress var(--toast-dur, 3500ms) linear forwards;
}
@keyframes at-toast-progress { to { transform: scaleX(0); } }

/* ===== Confirm modal ===== */
.at-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(15,23,42,.36);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: at-fade-in 180ms var(--at-ease-out, cubic-bezier(.16,1,.3,1));
}
[data-theme="dark"] .at-confirm-backdrop { background: rgba(0,0,0,.6); }
.at-confirm-backdrop.closing { animation: at-fade-out 180ms var(--at-ease-out) forwards; }
@keyframes at-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes at-fade-out { to { opacity: 0; } }

.at-confirm {
  width: 100%;
  max-width: 360px;
  background: var(--at-glass-strong, rgba(255,255,255,.96));
  backdrop-filter: var(--at-glass-blur, saturate(180%) blur(20px));
  -webkit-backdrop-filter: var(--at-glass-blur, saturate(180%) blur(20px));
  border: 1px solid var(--at-glass-border, rgba(255,255,255,.6));
  border-radius: 18px;
  padding: 20px 20px 14px;
  text-align: center;
  box-shadow: var(--at-shadow-lg, 0 24px 60px rgba(15,23,42,.2));
  color: var(--at-text, #0f172a);
  animation: at-confirm-in 280ms var(--at-ease-spring, cubic-bezier(.32,.72,0,1));
}
[data-theme="dark"] .at-confirm { background: rgba(28,28,30,.96); color: #f8fafc; }
@keyframes at-confirm-in {
  from { opacity: 0; transform: scale(.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.at-confirm.closing { animation: at-confirm-out 180ms ease-out forwards; }
@keyframes at-confirm-out { to { opacity: 0; transform: scale(.96); } }

.at-confirm-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(99,102,241,.14);
  color: var(--at-primary, #6366f1);
}
.at-confirm.danger .at-confirm-icon { background: rgba(239,68,68,.14); color: #ef4444; }
.at-confirm-icon svg { width: 24px; height: 24px; }

.at-confirm-title {
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.at-confirm-message {
  font-size: 14px;
  color: var(--at-text-soft, #475569);
  line-height: 1.45;
  margin-bottom: 16px;
}
[data-theme="dark"] .at-confirm-message { color: #cbd5e1; }

.at-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.at-confirm-btn {
  appearance: none;
  border: none;
  padding: 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  font-family: inherit;
  transition: filter var(--at-dur-fast, 180ms), transform var(--at-dur-fast, 180ms);
}
.at-confirm-btn:active { transform: scale(.97); }
.at-confirm-cancel { background: rgba(0,0,0,.06); color: var(--at-text, #0f172a); }
[data-theme="dark"] .at-confirm-cancel { background: rgba(255,255,255,.08); color: #f8fafc; }
.at-confirm-ok { background: var(--at-grad, linear-gradient(135deg,#6366f1,#8b5cf6)); color: #fff; }
.at-confirm.danger .at-confirm-ok { background: linear-gradient(135deg,#ef4444,#dc2626); }
.at-confirm-btn:hover { filter: brightness(1.05); }
