/* ============================================
   TOAST NOTIFICATION SYSTEM
   Professional replacement for browser alert()
   ============================================ */

/* Container — stacks toasts in top-right corner */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100% - 48px);
}

/* Individual toast */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 14px;
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', 'IBM Plex Sans Arabic', -apple-system, sans-serif;
}

.toast.toast-enter {
  transform: translateX(0);
  opacity: 1;
}

.toast.toast-exit {
  transform: translateX(120%);
  opacity: 0;
}

/* Toast icon */
.toast-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

/* Toast content */
.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.toast-message {
  font-size: 0.82rem;
  line-height: 1.45;
  opacity: 0.88;
  word-break: break-word;
}

/* Close button */
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 2px;
  line-height: 1;
  color: inherit;
}

.toast-close:hover {
  opacity: 1;
}

/* Progress bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 14px 14px;
  animation: toast-progress-shrink linear forwards;
}

@keyframes toast-progress-shrink {
  from { width: 100%; }
  to   { width: 0%; }
}


/* ─── LIGHT THEME VARIANTS ─── */

/* Success — Green */
.toast-success {
  background: rgba(240, 253, 244, 0.92);
  border-color: rgba(34, 197, 94, 0.2);
  color: #14532d;
}

.toast-success .toast-icon {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.toast-success .toast-progress {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

/* Error — Red */
.toast-error {
  background: rgba(254, 242, 242, 0.92);
  border-color: rgba(239, 68, 68, 0.2);
  color: #7f1d1d;
}

.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.toast-error .toast-progress {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Warning — Amber */
.toast-warning {
  background: rgba(255, 251, 235, 0.92);
  border-color: rgba(245, 158, 11, 0.2);
  color: #78350f;
}

.toast-warning .toast-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.toast-warning .toast-progress {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

/* Info — Blue */
.toast-info {
  background: rgba(239, 246, 255, 0.92);
  border-color: rgba(59, 130, 246, 0.2);
  color: #1e3a5f;
}

.toast-info .toast-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.toast-info .toast-progress {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}


/* ─── DARK THEME VARIANTS ─── */

[data-theme="dark"] .toast-success {
  background: rgba(20, 83, 45, 0.85);
  border-color: rgba(34, 197, 94, 0.25);
  color: #dcfce7;
}

[data-theme="dark"] .toast-success .toast-icon {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

[data-theme="dark"] .toast-error {
  background: rgba(127, 29, 29, 0.85);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fee2e2;
}

[data-theme="dark"] .toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

[data-theme="dark"] .toast-warning {
  background: rgba(120, 53, 15, 0.85);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fef3c7;
}

[data-theme="dark"] .toast-warning .toast-icon {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .toast-info {
  background: rgba(30, 58, 95, 0.85);
  border-color: rgba(59, 130, 246, 0.25);
  color: #dbeafe;
}

[data-theme="dark"] .toast-info .toast-icon {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}


/* ─── RESPONSIVE ─── */

@media (max-width: 480px) {
  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: 100%;
  }

  .toast {
    padding: 14px 16px;
    border-radius: 12px;
    gap: 12px;
  }

  .toast-icon {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .toast-title {
    font-size: 0.82rem;
  }

  .toast-message {
    font-size: 0.78rem;
  }
}
