/* Açılır bildirimler (toast): sayfa düzeninin üzerinde, kendiliğinden kapanır.
   Tüm siteler (genel site, panel, portal) templates/partials/messages.html ile yükler. */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  --toast-accent: #146C43;
  --toast-tint: #E4F8EF;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 12px 14px 14px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(15, 27, 45, 0.08);
  border-left: 4px solid var(--toast-accent);
  background: var(--color-surface);
  color: var(--color-heading);
  box-shadow: 0 10px 30px rgba(15, 27, 45, 0.16), 0 2px 6px rgba(15, 27, 45, 0.08);
  font-size: 0.9rem;
  line-height: 1.4;
  pointer-events: auto;
  animation: toast-in 0.22s ease-out;
}

.toast--success { --toast-accent: #0ca30c; --toast-tint: #E4F8EF; }
.toast--info,
.toast--debug { --toast-accent: #2a78d6; --toast-tint: #EAF2FD; }
.toast--warning { --toast-accent: #d99a00; --toast-tint: #FFF3CD; }
.toast--error { --toast-accent: #d03b3b; --toast-tint: #FDECEC; }

.toast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--toast-tint);
  color: var(--toast-accent);
}

.toast__icon svg { width: 16px; height: 16px; }

.toast__body { flex: 1; min-width: 0; padding-top: 3px; overflow-wrap: anywhere; }

.toast__action {
  margin-top: 8px;
  padding: 5px 12px;
  border: 0;
  border-radius: 6px;
  background: var(--toast-accent);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.toast__close {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  margin: -2px -4px 0 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.toast__close:hover,
.toast__close:focus-visible { background: var(--color-surface-2); color: var(--color-heading); }

/* Kalan süre çubuğu: üzerine gelince durur. */
.toast__timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--toast-accent);
  opacity: 0.35;
  transform-origin: left;
  animation: toast-timer linear forwards;
}

.toast:hover .toast__timer,
.toast:focus-within .toast__timer { animation-play-state: paused; }

.toast.is-leaving { animation: toast-out 0.2s ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

@keyframes toast-timer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 600px) {
  .toast-stack {
    top: 12px;
    right: 16px;
    left: 16px;
    width: auto;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.is-leaving { animation: none; }
}

@media print {
  .toast-stack { display: none; }
}
