/* ============================================================
   toast.css — Modern İkonlu Toast Bildirim Sistemi
   4 tip: success / warning / danger / info
   Sağ üstten kayarak gelir, progress bar ile otomatik kapanır.
   ============================================================ */

/* ── Konteyner ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 16px));
  right: 16px;
  bottom: auto;
  left: auto;
  z-index: 99999999 !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 380px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

/* ── Tekil Toast ─────────────────────────────────────────── */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  pointer-events: all;
  position: relative;
  overflow: hidden;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
}

.toast.toast-hiding {
  animation: toastSlideOut 0.25s cubic-bezier(0.4, 0, 1, 1) forwards !important;
  pointer-events: none !important;
}

/* Sol renkli kenarlık şerit */
.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

/* ── Tip Renkleri ────────────────────────────────────────── */
.toast-success::before { background: var(--color-success, #10b981); }
.toast-warning::before { background: var(--color-warning, #f59e0b); }
.toast-danger::before  { background: var(--color-danger, #ef4444); }
.toast-info::before    { background: var(--color-info, #3b82f6); }

/* ── İkon ────────────────────────────────────────────────── */
.toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-success .toast-icon { background: rgba(16, 185, 129, 0.12); color: var(--color-success, #10b981); }
.toast-warning .toast-icon { background: rgba(245, 158, 11, 0.14); color: var(--color-warning, #f59e0b); }
.toast-danger  .toast-icon { background: rgba(239, 68, 68, 0.12);  color: var(--color-danger, #ef4444); }
.toast-info    .toast-icon { background: rgba(59, 130, 246, 0.12); color: var(--color-info, #3b82f6); }

.toast-icon svg { width: 18px; height: 18px; }

/* ── İçerik ──────────────────────────────────────────────── */
.toast-body,
.toast-content {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink, #1e293b);
  margin-bottom: 2px;
  line-height: 1.3;
}

.toast-message {
  font-size: 12px;
  color: var(--color-ink-muted, #64748b);
  line-height: 1.45;
}

/* ── Kapat Butonu ────────────────────────────────────────── */
.toast-close {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--color-ink-muted, #94a3b8);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  padding: 0;
  margin-top: -2px;
  margin-right: -2px;
  pointer-events: all;
  outline: none;
  z-index: 2;
}

.toast-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-ink, #0f172a);
}

.toast-close svg { width: 14px; height: 14px; }

/* ── Progress Bar (süre göstergesi) ─────────────────────── */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 4px; /* sol border şeridi kadar içeri */
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left;
  animation: toastProgress linear forwards;
}

.toast-success .toast-progress-bar { background: var(--color-success, #10b981); }
.toast-warning .toast-progress-bar { background: var(--color-warning, #f59e0b); }
.toast-danger  .toast-progress-bar { background: var(--color-danger, #ef4444); }
.toast-info    .toast-progress-bar { background: var(--color-info, #3b82f6); }

/* Hover'da progress durur */
.toast:hover .toast-progress-bar { animation-play-state: paused; }

/* ── Karanlık Tema ───────────────────────────────────────── */
[data-theme="dark"] .toast {
  background: var(--color-surface, #1e293b);
  border-color: var(--color-border, #334155);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.45), 0 8px 10px -6px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

[data-theme="dark"] .toast-progress {
  background: rgba(255, 255, 255, 0.08);
}

/* ── Animasyonlar ────────────────────────────────────────── */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(110%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  0% {
    opacity: 1;
    transform: translateX(0);
    max-height: 160px;
    margin-bottom: 0;
  }
  100% {
    opacity: 0;
    transform: translateX(110%);
    max-height: 0;
    margin-bottom: -10px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ── Mobil & Responsive: Her zaman sağ üstte tut ─────────── */
@media (max-width: 768px) {
  .toast-container {
    top: max(12px, env(safe-area-inset-top, 12px)) !important;
    right: 12px !important;
    bottom: auto !important;
    left: auto !important;
    width: min(340px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    z-index: 99999999 !important;
  }
}

