/* Premium Digital Analog Toast Notifications */

.flash-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-md);
  pointer-events: none;
  max-width: 400px;
  width: calc(100% - var(--space-xl));
}

.flash-message.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  background: rgba(18, 18, 20, 0.85); /* Deep dark with alpha */
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: var(--ui-text);
  padding: 16px 20px;
  
  /* Framed Digital Analog Look */
  border: 1px solid rgba(201, 168, 106, 0.3); /* Subtle brass frame */
  border-left: 4px solid var(--ui-accent); /* Main accent bar */
  border-radius: 8px;
  
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 
              inset 0 1px 0 rgba(255, 255, 255, 0.05); /* Top highlight */
  
  pointer-events: auto;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.6;
  
  /* Animations */
  animation: toast-slide-up 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Specific States with colored left bars */
.flash-message.toast--success {
  border-left-color: var(--success);
}

.flash-message.toast--danger {
  border-left-color: var(--danger);
}

.flash-message.toast--info {
  border-left-color: var(--ui-accent);
}

.flash-message.toast--hiding {
  animation: toast-slide-down 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards;
  pointer-events: none;
}

/* Icon & Content */
.toast__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: inherit;
  opacity: 0.9;
}

.toast__icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 2.5;
}

.toast__content {
  flex-grow: 1;
  font-weight: 450; /* Slightly punchy medium */
  letter-spacing: 0.01em;
}

/* Refined Close Button */
.toast__close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  padding: 0;
  margin: -12px -12px -12px 0;
  color: var(--ui-text);
  cursor: var(--cursor-pointer);
  border-radius: 6px;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ui-text);
  transform: scale(1.1);
}

.toast__close:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
}

.toast__close svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* Motion Design */
@keyframes toast-slide-up {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-slide-down {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
}

/* Responsive (Floating Center for Small Screens) */
@media (max-width: 640px) {
  .flash-container {
    bottom: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
    width: auto;
    max-width: none;
  }
  
  .flash-message.toast {
    animation-name: toast-slide-up-mobile;
  }

  .flash-message.toast--hiding {
    animation-name: toast-slide-down;
  }
}

@keyframes toast-slide-up-mobile {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .flash-message.toast,
  .flash-message.toast--hiding {
    animation-duration: 1ms;
  }
}
