/* Toast + modal notifications (used instead of alert/confirm) */

:root {
  --notify-radius: 14px;
  --notify-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.12));
  --notify-border: var(--border, rgba(17, 24, 39, 0.14));
  --notify-surface: var(--surface, #ffffff);
  --notify-surface-2: var(--surface-2, #f3f4f6);
  --notify-text: var(--text, #111827);
  --notify-muted: var(--muted, #6b7280);
  --notify-primary: var(--primary, #2563eb);
  --notify-danger: var(--danger, #b00020);

  --notify-info: #2563eb;
  --notify-success: #059669;
  --notify-warning: #d97706;
  --notify-error: #dc2626;
}

.admin-body {
  --notify-shadow: var(--admin-shadow, 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.08));
  --notify-border: var(--admin-border, rgba(15, 23, 42, 0.12));
  --notify-surface: var(--admin-surface, #ffffff);
  --notify-surface-2: var(--admin-surface-2, #f1f5f9);
  --notify-text: var(--admin-text, #0f172a);
  --notify-muted: var(--admin-muted, #64748b);
  --notify-primary: var(--admin-primary, #2563eb);
  --notify-danger: var(--admin-danger, #b91c1c);
}

.notify-toast-region {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: min(92vw, 420px);

  /* theme-base.css applies `body > * { max-width: ...; margin: auto; }`.
     Ensure fixed overlays are not constrained/centered. */
  margin: 0 !important;
}

.notify-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 10px 34px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 12px 12px 12px 0;
  border: 1px solid var(--notify-border);
  background: var(--notify-surface);
  background: color-mix(in srgb, var(--notify-surface) 92%, transparent);
  color: var(--notify-text);
  border-radius: var(--notify-radius);
  box-shadow: var(--notify-shadow);
  backdrop-filter: blur(8px);
  overflow: hidden;

  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 150ms ease, transform 180ms ease;
}

.notify-toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.notify-toast.is-leaving {
  opacity: 0;
  transform: translateY(-4px);
}

.notify-toast::before {
  content: "";
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 10px;
  height: 100%;
  background: var(--notify-info);
}

.notify-toast[data-type="success"]::before { background: var(--notify-success); }
.notify-toast[data-type="warning"]::before { background: var(--notify-warning); }
.notify-toast[data-type="error"]::before { background: var(--notify-error); }

.notify-toast-icon {
  grid-column: 2;
  margin-top: 2px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--notify-border);
  background: var(--notify-surface-2);
  color: var(--notify-text);
  font-weight: 900;
}

.notify-toast[data-type="info"] .notify-toast-icon { color: var(--notify-info); }
.notify-toast[data-type="success"] .notify-toast-icon { color: var(--notify-success); }
.notify-toast[data-type="warning"] .notify-toast-icon { color: var(--notify-warning); }
.notify-toast[data-type="error"] .notify-toast-icon { color: var(--notify-error); }

.notify-toast-icon::before { content: "i"; }
.notify-toast[data-type="success"] .notify-toast-icon::before { content: "✓"; }
.notify-toast[data-type="warning"] .notify-toast-icon::before { content: "!"; }
.notify-toast[data-type="error"] .notify-toast-icon::before { content: "×"; }

.notify-toast-title {
  font-weight: 800;
  letter-spacing: -0.2px;
  margin-top: 2px;
}

.notify-toast-message {
  margin-top: 2px;
  line-height: 1.35;
  color: var(--notify-text);
}

.notify-toast-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.notify-toast-close {
  border: 1px solid var(--notify-border);
  background: var(--notify-surface-2);
  color: var(--notify-text);
  border-radius: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.notify-toast-close:hover {
  filter: brightness(0.98);
}

.notify-toast-progress {
  grid-column: 2 / span 3;
  height: 3px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.notify-toast-progress > div {
  height: 100%;
  width: 100%;
  background: var(--notify-primary);
  background: color-mix(in srgb, var(--notify-primary) 75%, transparent);
  transform-origin: left;
  transform: scaleX(1);
}

.notify-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;

  /* Prevent global layout constraints from shrinking the backdrop */
  max-width: none !important;
  margin: 0 !important;
}

.notify-modal-backdrop[data-open="true"] {
  display: flex;
}

.notify-modal {
  width: min(92vw, 520px);
  border-radius: 18px;
  border: 1px solid var(--notify-border);
  background: var(--notify-surface);
  box-shadow: var(--notify-shadow);
  overflow: hidden;
}

.notify-modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--notify-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notify-modal-title {
  font-weight: 900;
  letter-spacing: -0.3px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notify-modal-close {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--notify-border);
  background: var(--notify-surface-2);
  color: var(--notify-text);
  border-radius: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.notify-modal-close:hover {
  filter: brightness(0.98);
}

.notify-modal-close:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--notify-primary) 35%, transparent);
  outline-offset: 2px;
}

.notify-modal-body {
  padding: 14px 16px;
  color: var(--notify-text);
  line-height: 1.45;
}

.notify-modal-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--notify-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.notify-btn {
  border: 1px solid var(--notify-border);
  background: var(--notify-surface-2);
  color: var(--notify-text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
}

.notify-btn:hover { filter: brightness(0.98); }

.notify-btn-primary {
  border-color: var(--notify-border);
  border-color: color-mix(in srgb, var(--notify-primary) 40%, var(--notify-border));
  background: var(--notify-primary);
  color: #fff;
}

.notify-btn-danger {
  border-color: var(--notify-border);
  border-color: color-mix(in srgb, var(--notify-danger) 40%, var(--notify-border));
  background: var(--notify-danger);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .notify-toast-progress > div { transition: none !important; }
}
