/* ============================================================
   Toast notifications — shared by public site + admin panel.
   Server-rendered toasts stay visible without JS; toast.js adds
   auto-dismiss, a close button, and window.showToast() for JS use.
   ============================================================ */
.toast-root {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: min(380px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  --toast-accent: #16a34a;
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: #ffffff;
  color: #1f2733;
  border-left: 4px solid var(--toast-accent);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  font-size: 0.95rem;
  line-height: 1.4;
  animation: toast-in 0.32s cubic-bezier(0.21, 1.02, 0.73, 1) both;
}
.toast.toast-hide {
  animation: toast-out 0.28s ease forwards;
}

.toast-success { --toast-accent: #16a34a; }
.toast-error   { --toast-accent: #dc2626; }
.toast-info    { --toast-accent: #2563eb; }
.toast-warning { --toast-accent: #d97706; }

.toast-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--toast-accent);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.toast-msg { flex: 1 1 auto; padding-top: 1px; }

.toast-close {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: #9aa5b4;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.15s ease;
}
.toast-close:hover { color: #4b5563; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px) scale(0.98); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(24px); }
}

@media (max-width: 560px) {
  .toast-root { top: 12px; right: 12px; left: 12px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.toast-hide { animation: none; }
}

/* Submit-button loading / disabled states (double-submit guard) */
button:disabled,
.btn:disabled,
.button:disabled { opacity: 0.65; cursor: not-allowed; }

.is-loading {
  position: relative;
  cursor: progress !important;
  pointer-events: none;
}
.is-loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: toast-spin 0.6s linear infinite;
}
@keyframes toast-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .is-loading::after { animation: none; }
}

/* Inline field validation states (used by the forms) */
.field-error { color: #dc2626; display: block; margin-top: 4px; font-size: 0.82rem; }
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}
