/**
 * dnd-toast.css
 *
 * Dandiran WooCommerce Theme — Shared Toast Notification System
 * Companion stylesheet for assets/js/dnd-toast.js.
 */

.dnd-toast-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 320px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.dnd-toast {
  --dnd-toast-color: #16a34a;
  --dnd-toast-bg: #f0fdf4;

  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 14px 16px;
  background: #fff;
  border-radius: 10px;
  border-right: 4px solid var(--dnd-toast-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-12px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: auto;
  direction: rtl;
}

.dnd-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.dnd-toast.is-leaving {
  opacity: 0;
  transform: translateY(-12px);
}

.dnd-toast--success {
  --dnd-toast-color: #16a34a;
  --dnd-toast-bg: #f0fdf4;
}

.dnd-toast--danger {
  --dnd-toast-color: #dc2626;
  --dnd-toast-bg: #fef2f2;
}

.dnd-toast--alert {
  --dnd-toast-color: #f59e0b;
  --dnd-toast-bg: #fffbeb;
}

.dnd-toast__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--dnd-toast-bg);
  color: var(--dnd-toast-color);
}

.dnd-toast__message {
  flex: 1;
  font-size: 13px;
  line-height: 1.6;
  color: #222;
  padding-top: 6px;
}

.dnd-toast__close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 50%;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.dnd-toast__close:hover {
  background: #f3f4f6;
  color: #374151;
}

.dnd-toast__timer {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.06);
}

.dnd-toast__timer-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--dnd-toast-color);
  transform-origin: right; /* RTL: bar drains from left toward the border */
  transform: scaleX(1);
  transition-property: transform;
  transition-timing-function: linear;
  /* transition-duration is set inline per-toast from JS (matches `duration`) */
}

.dnd-toast__timer-bar.is-depleting {
  transform: scaleX(0);
}

@media (prefers-reduced-motion: reduce) {
  .dnd-toast,
  .dnd-toast__timer-bar {
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 480px) {
  .dnd-toast-container {
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
  }
}
