/* Vanilla port of Emenes Documents notification banners (origin/main 75c10ce1).
   Sources: src/components/ui/toast.tsx + toaster.tsx (shadcn/Radix-style toast, Tailwind),
   src/index.css (tokens), src/pages/editor/EditorPresenceGuard.css (privacy variants).
   All Tailwind classes resolved to plain CSS. */
:root {
  /* light tokens (index.css :root) resolved */
  --dn-background: 0 0% 100%;      /* #ffffff */
  --dn-foreground: 0 0% 3.9%;      /* #0a0a0a */
  --dn-border: 0 0% 89.8%;         /* #e5e5e5 */
  --dn-secondary: 0 0% 96.1%;      /* #f5f5f5 */
  --dn-muted: 0 0% 96.1%;          /* #f5f5f5 */
  --dn-ring: 0 0% 3.9%;            /* #0a0a0a */
  --dn-destructive: 0 84.2% 60.2%; /* #ef4444 */
  --dn-destructive-foreground: 0 0% 98%; /* #fafafa */
  --dn-radius: 0.5rem;             /* rounded-md = radius - 2px = 6px */
  --dn-font: Arial, "Noto Sans Hebrew", "Segoe UI", system-ui, -apple-system, sans-serif;
}
.dark {
  --dn-background: 0 0% 3.9%;      /* #0a0a0a */
  --dn-foreground: 0 0% 98%;       /* #fafafa */
  --dn-border: 0 0% 14.9%;         /* #262626 */
  --dn-secondary: 0 0% 14.9%;      /* #262626 */
  --dn-muted: 0 0% 14.9%;
  --dn-ring: 0 0% 83.1%;           /* #d4d4d4 */
  --dn-destructive: 0 62.8% 30.6%; /* #7f1d1d */
  --dn-destructive-foreground: 0 0% 98%;
}

/* ToastProvider: fixed bottom-0 right-0 z-[2000] flex max-h-[100dvh] w-full flex-col gap-3 overflow-y-auto p-4 md:max-w-[420px] */
.dn-region {
  pointer-events: none; position: fixed; bottom: 0; right: 0; z-index: 2000;
  display: flex; flex-direction: column; gap: 12px; max-height: 100dvh; width: 100%;
  overflow-y: auto; padding: 16px; box-sizing: border-box; font-family: var(--dn-font);
}
@media (min-width: 768px) { .dn-region { max-width: 420px; } }
.dn-region.dn-static { position: static; max-height: none; overflow: visible; pointer-events: auto; }

/* Toast base (cva toastVariants) */
.dn-toast {
  pointer-events: auto; position: relative; display: flex; width: 100%; flex-shrink: 0;
  align-items: center; justify-content: space-between; overflow: hidden; box-sizing: border-box;
  border-radius: calc(var(--dn-radius) - 2px); border: 1px solid hsl(var(--dn-border));
  padding: 24px 32px 24px 24px; /* p-6 pr-8 (physical: close sits on the right) */
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); /* shadow-lg */
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);               /* backdrop-blur-sm */
  transition: all .15s cubic-bezier(.4,0,.2,1);                                  /* transition-all */
  font-family: var(--dn-font); text-align: start;
}
/* data-[state=open]:animate-in slide-in-from-bottom-full (tailwindcss-animate: 150ms) */
.dn-toast[data-state="open"] { animation: dn-enter .15s cubic-bezier(.4,0,.2,1) both; }
.dn-toast[data-state="closed"] { display: none; } /* Documents filters closed toasts out (no exit anim) */
@keyframes dn-enter { from { transform: translate3d(0,100%,0); } to { transform: none; } }

/* variant=default: bg-background/60 text-foreground */
.dn-toast--default { background: hsl(var(--dn-background) / .6); color: hsl(var(--dn-foreground)); }
/* variant=destructive: border-destructive bg-destructive/70 text-destructive-foreground */
.dn-toast--destructive { border-color: hsl(var(--dn-destructive)); background: hsl(var(--dn-destructive) / .7); color: hsl(var(--dn-destructive-foreground)); }

/* Toaster inner layout */
.dn-row { display: flex; min-width: 0; flex: 1; align-items: flex-start; gap: 12px; }
.dn-icon { display: block; margin-top: 2px; width: 40px; height: 40px; flex-shrink: 0; object-fit: contain; }
.dn-text { display: grid; min-width: 0; flex: 1; gap: 4px; overflow-wrap: break-word; }
.dn-title { font-size: 14px; line-height: 20px; font-weight: 600; }
.dn-desc { font-size: 14px; line-height: 20px; opacity: .9; }
.dn-actions { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ToastAction */
.dn-action {
  display: inline-flex; height: 32px; flex-shrink: 0; align-items: center; justify-content: center;
  border-radius: calc(var(--dn-radius) - 2px); border: 1px solid hsl(var(--dn-border)); background: transparent;
  padding: 0 12px; font: 500 14px/20px var(--dn-font); color: inherit; cursor: pointer;
  transition: color .15s, background-color .15s, border-color .15s;
}
.dn-action:hover { background: hsl(var(--dn-secondary)); }
.dn-action:focus { outline: none; box-shadow: 0 0 0 2px hsl(var(--dn-background)), 0 0 0 4px hsl(var(--dn-ring)); }
.dn-action:disabled { pointer-events: none; opacity: .5; }
.dn-toast--destructive .dn-action { border-color: hsl(var(--dn-muted) / .4); }
.dn-toast--destructive .dn-action:hover { border-color: hsl(var(--dn-destructive) / .3); background: hsl(var(--dn-destructive)); color: hsl(var(--dn-destructive-foreground)); }
.dn-toast--destructive .dn-action:focus { box-shadow: 0 0 0 2px hsl(var(--dn-background)), 0 0 0 4px hsl(var(--dn-destructive)); }

/* ToastClose: absolute right-2 top-2 rounded-md p-1 text-foreground/70, X icon h-4 w-4 */
.dn-close {
  position: absolute; right: 8px; top: 8px; z-index: 10; border: 0; background: none; cursor: pointer;
  border-radius: calc(var(--dn-radius) - 2px); padding: 4px; line-height: 0;
  color: hsl(var(--dn-foreground) / .7); transition: color .15s;
}
.dn-close:hover { color: hsl(var(--dn-foreground)); }
.dn-close:focus { outline: none; box-shadow: 0 0 0 2px hsl(var(--dn-ring)); }
.dn-close svg { width: 16px; height: 16px; }
.dn-toast--destructive .dn-close { color: #fecaca; }            /* red-200 */
.dn-toast--destructive .dn-close:hover { color: #fef2f2; }      /* red-50 */
.dn-toast--destructive .dn-close:focus { box-shadow: 0 0 0 2px #dc2626, 0 0 0 4px #f87171; } /* ring-red-400 offset-red-600 */

/* Privacy (presence-shield) variants: fixed colors, same in light & dark */
.dn-toast--privacy { border-color: #96626b; background: #513a43; color: #fff; }
.dn-toast--privacy.dn-tone-success { border-color: #507d65; background: #304d3e; }
.dn-toast--privacy.dn-tone-neutral { border-color: #5b7180; background: #344450; }
.dn-toast--privacy .dn-row { align-items: center; }
.dn-toast--privacy .dn-icon { margin-top: 0; }
.dn-toast--privacy .dn-title { color: #e5e7eb; }
.dn-toast--privacy .dn-desc { color: #fff; opacity: 1; }
.dn-toast--privacy .dn-close { color: inherit; }
.dn-toast--privacy[data-state="open"] { animation: dn-privacy-enter .22s ease-out both; }
@keyframes dn-privacy-enter { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

@media (prefers-reduced-motion: reduce) { .dn-toast[data-state="open"] { animation: none; } }

/* RTL: Documents itself uses PHYSICAL right-anchoring (region bottom-right, close right-2, pr-8) and
   does not flip; only text uses text-align:start. Faithful default = no flip.
   Opt-in mirroring for an RTL-first host: add class "dn-mirror" on the region. */
.dn-mirror { right: auto; left: 0; }
.dn-mirror .dn-toast { padding: 24px 24px 24px 32px; }
.dn-mirror .dn-close { right: auto; left: 8px; }
.dn-mirror .dn-toast--privacy[data-state="open"] { animation-name: dn-privacy-enter-rtl; }
@keyframes dn-privacy-enter-rtl { from { opacity: 0; transform: translateX(-100%); } to { opacity: 1; transform: translateX(0); } }

/* ---- Emenes Mail adapter for the Documents banner kit ---- */
/* Dark tokens follow the host theme: the mail portal sets html[data-theme]; pages without one follow the OS. */
:root[data-theme="dark"] {
  --dn-background: 0 0% 3.9%; --dn-foreground: 0 0% 98%; --dn-border: 0 0% 14.9%; --dn-secondary: 0 0% 14.9%;
  --dn-muted: 0 0% 14.9%; --dn-ring: 0 0% 83.1%; --dn-destructive: 0 62.8% 30.6%; --dn-destructive-foreground: 0 0% 98%;
}
/* Derived warning variant (Documents has none): same recipe as destructive — amber border, amber/70 background. */
:root { --dn-warning: 37.7 92.1% 50.2%; --dn-warning-foreground: 0 0% 3.9%; }          /* #f59e0b on #0a0a0a */
.dark, :root[data-theme="dark"] { --dn-warning: 22.7 82.5% 31.4%; --dn-warning-foreground: 0 0% 98%; } /* #92400e on #fafafa */
.dn-toast--warning { border-color: hsl(var(--dn-warning)); background: hsl(var(--dn-warning) / .7); color: hsl(var(--dn-warning-foreground)); }
.dn-toast--warning .dn-action { border-color: hsl(var(--dn-warning-foreground) / .3); }
.dn-toast--warning .dn-action:hover { background: hsl(var(--dn-warning)); }
.dn-toast--warning .dn-close { color: hsl(var(--dn-warning-foreground) / .7); }
/* In-place updates (countdowns, progress) must not replay the slide-in. */
.dn-toast[data-dn-updated] { animation: none !important; }
/* Legacy notice elements are mirrored into banners and hidden. */
[data-dn-bridged] { display: none !important; }
/* Content cards that must stay in the page flow (links, codes, copy buttons) use the Documents default surface. */
.success-card, .hint, :has(> .success-label) {
  background: hsl(var(--dn-background) / .6) !important; color: hsl(var(--dn-foreground)) !important;
  border: 1px solid hsl(var(--dn-border)) !important; border-radius: calc(var(--dn-radius) - 2px) !important;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1) !important;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); font-family: var(--dn-font);
}
.success-card, :has(> .success-label) { padding: 24px !important; }
.hint { padding: 12px 16px !important; font-size: 14px; line-height: 20px; }
.success-card h3, .success-label { display: block; margin: 0 0 4px; padding: 0 !important; border: 0 !important; background: none !important;
  color: inherit !important; font: 600 14px/20px var(--dn-font) !important; letter-spacing: 0 !important; text-transform: none !important; }
