/* Toast Notification Styles */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  max-width: 420px;
  pointer-events: none;
}

/* ============================================
   LIGHT MODE (Default)
   ============================================ */
.toast {
  background: #ffffff;
  border-radius: 10px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.08);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease-out;
  border-left: 4px solid #3498db;
  position: relative;
  overflow: hidden;
  color: #2c3e50;
  border: 1px solid #e2e8f0;
}

.toast.toast-success {
  border-left-color: #10b981;
  border-color: #d1fae5;
}

.toast.toast-error {
  border-left-color: #ef4444;
  border-color: #fee2e2;
}

.toast.toast-info {
  border-left-color: #3b82f6;
  border-color: #dbeafe;
}

.toast.toast-warning {
  border-left-color: #f59e0b;
  border-color: #fef3c7;
}

.toast-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
}

.toast.toast-success .toast-icon {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

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

.toast.toast-info .toast-icon {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

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

.toast-loading {
  width: 22px;
  height: 22px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: toastSpin 1s linear infinite;
  flex-shrink: 0;
}

.toast.toast-success .toast-loading {
  border-top-color: #10b981;
}

.toast.toast-error .toast-loading {
  border-top-color: #ef4444;
}

.toast.toast-info .toast-loading {
  border-top-color: #3b82f6;
}

.toast.toast-warning .toast-loading {
  border-top-color: #f59e0b;
}

.toast-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  color: #1f2937;
  line-height: 1.4;
}

.toast-message {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: normal;
  max-height: none;
  overflow: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.toast-message::-webkit-scrollbar {
  display: none;
}

.toast-close {
  flex-shrink: 0;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
  color: #6b7280;
  font-size: 18px;
  line-height: 0;
  font-weight: 600;
  transition: all 0.2s ease;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  position: relative;
}

.toast-close:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #374151;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.08);
  width: 100%;
  transform-origin: left;
  animation: toastProgress linear;
}

.toast.toast-success .toast-progress {
  background: rgba(16, 185, 129, 0.25);
}

.toast.toast-error .toast-progress {
  background: rgba(239, 68, 68, 0.25);
}

.toast.toast-info .toast-progress {
  background: rgba(59, 130, 246, 0.25);
}

.toast.toast-warning .toast-progress {
  background: rgba(245, 158, 11, 0.25);
}

/* ============================================
   DARK MODE
   ============================================ */
body.theme-dark .toast {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

body.theme-dark .toast.toast-success {
  border-left-color: #10b981;
  border-color: #065f46;
}

body.theme-dark .toast.toast-error {
  border-left-color: #ef4444;
  border-color: #7f1d1d;
}

body.theme-dark .toast.toast-info {
  border-left-color: #3b82f6;
  border-color: #1e3a8a;
}

body.theme-dark .toast.toast-warning {
  border-left-color: #f59e0b;
  border-color: #78350f;
}

body.theme-dark .toast-icon {
  background: rgba(255, 255, 255, 0.08);
}

body.theme-dark .toast.toast-success .toast-icon {
  color: #34d399;
  background: rgba(16, 185, 129, 0.2);
}

body.theme-dark .toast.toast-error .toast-icon {
  color: #f87171;
  background: rgba(239, 68, 68, 0.2);
}

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

body.theme-dark .toast.toast-warning .toast-icon {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.2);
}

body.theme-dark .toast-loading {
  border-color: #475569;
}

body.theme-dark .toast.toast-success .toast-loading {
  border-top-color: #34d399;
}

body.theme-dark .toast.toast-error .toast-loading {
  border-top-color: #f87171;
}

body.theme-dark .toast.toast-info .toast-loading {
  border-top-color: #60a5fa;
}

body.theme-dark .toast.toast-warning .toast-loading {
  border-top-color: #fbbf24;
}

body.theme-dark .toast-title {
  color: #f1f5f9;
}

body.theme-dark .toast-message {
  color: #cbd5e1;
}

body.theme-dark .toast-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
}

body.theme-dark .toast-close:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: #f1f5f9;
}

body.theme-dark .toast-progress {
  background: rgba(255, 255, 255, 0.1);
}

body.theme-dark .toast.toast-success .toast-progress {
  background: rgba(16, 185, 129, 0.4);
}

body.theme-dark .toast.toast-error .toast-progress {
  background: rgba(239, 68, 68, 0.4);
}

body.theme-dark .toast.toast-info .toast-progress {
  background: rgba(59, 130, 246, 0.4);
}

body.theme-dark .toast.toast-warning .toast-progress {
  background: rgba(245, 158, 11, 0.4);
}

/* ============================================
   Animations
   ============================================ */
@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes toastSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

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

.toast.toast-sliding-out {
  animation: toastSlideOut 0.3s ease-in forwards;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}
