/**
 * toast.css — Global Professional Heritage Toast System
 * Works for both Public Site and Admin Panel
 */

:root {
  --toast-success: #1E7B4F;
  --toast-success-bg: #EAF6EF;
  --toast-error: #B91C1C;
  --toast-error-bg: #FDF2F2;
  --toast-warning: #D97706;
  --toast-warning-bg: #FFFBEB;
  --toast-info: #A9792B;
  --toast-info-bg: #FAF5EA;
  --toast-card-bg: #FFFFFF;
  --toast-border: #E8DEC8;
  --toast-ink: #2B1D14;
  --toast-muted: #6B5645;
}

/* Toast Container */
#toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
  max-width: 420px;
  width: calc(100vw - 3rem);
}

@media (max-width: 600px) {
  #toast-container {
    top: 1rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(92vw, 400px);
  }
}

/* Toast Card */
.toast-card {
  position: relative;
  background: var(--toast-card-bg);
  border: 1px solid var(--toast-border);
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(43, 29, 20, 0.12), 0 8px 10px -6px rgba(43, 29, 20, 0.08);
  overflow: hidden;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(110%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

@media (max-width: 600px) {
  .toast-card {
    transform: translateY(-120%);
  }
}

.toast-card.is-visible {
  opacity: 1;
  transform: translate(0, 0);
}

.toast-card.is-hiding {
  opacity: 0;
  transform: translateX(110%);
}

@media (max-width: 600px) {
  .toast-card.is-hiding {
    transform: translateY(-120%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast-card {
    transform: none !important;
    transition: opacity 0.15s ease !important;
  }
  .toast-progress-bar {
    animation: none !important;
  }
}

/* Left colored accent bar */
.toast-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 5px;
  background: var(--toast-accent, var(--toast-info));
}

/* Toast Body */
.toast-body {
  padding: 0.95rem 1rem 0.95rem 1.15rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

/* Icon in tinted circle */
.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--toast-icon-bg, var(--toast-info-bg));
  color: var(--toast-accent, var(--toast-info));
}

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

/* Text Container */
.toast-text {
  flex: 1 1 auto;
  min-width: 0;
}

.toast-title {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--toast-ink);
  margin: 0 0 0.2rem 0;
  line-height: 1.25;
}

.toast-message {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.825rem;
  color: var(--toast-muted);
  line-height: 1.45;
  margin: 0;
  word-break: break-word;
}

/* Close button */
.toast-close {
  background: transparent;
  border: none;
  color: #9C8979;
  cursor: pointer;
  padding: 0.25rem;
  margin: -0.25rem -0.25rem 0 0;
  border-radius: 4px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background-color 0.15s;
}

.toast-close:hover {
  color: var(--toast-ink);
  background: rgba(43, 29, 20, 0.06);
}

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

/* Progress bar */
.toast-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(43, 29, 20, 0.05);
  position: relative;
  overflow: hidden;
}

.toast-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: var(--toast-accent, var(--toast-info));
  transform-origin: left;
  animation: toast-timer linear forwards;
}

.toast-card:hover .toast-progress-bar {
  animation-play-state: paused;
}

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

/* Variants */
.toast-card--success {
  --toast-accent: var(--toast-success);
  --toast-icon-bg: var(--toast-success-bg);
}

.toast-card--error {
  --toast-accent: var(--toast-error);
  --toast-icon-bg: var(--toast-error-bg);
}

.toast-card--warning {
  --toast-accent: var(--toast-warning);
  --toast-icon-bg: var(--toast-warning-bg);
}

.toast-card--info {
  --toast-accent: var(--toast-info);
  --toast-icon-bg: var(--toast-info-bg);
}
