/* ============================================
   Flash Toast — "Clean Signal" Design
   ============================================ */

.flash-toast-stack {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

/* --- Base toast --- */
.flash-toast {
  --flash-accent: #64748b;
  --flash-accent-rgb: 100, 116, 139;
  --flash-bg: #f8fafc;
  --flash-border: #e2e8f0;
  --flash-fg: #1e293b;
  --flash-fg-muted: #475569;

  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  background: var(--flash-bg);
  border: 1px solid var(--flash-border);
  overflow: hidden;

  /* Entrance state */
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  transition: none;

  font-family: 'Nunito Sans', sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;

  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.03);
}

.flash-toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hover lift */
.flash-toast:hover {
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.05);
}

/* --- Exit animation --- */
.flash-toast--exiting {
  animation: flash-exit 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

@keyframes flash-exit {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    max-height: 12rem;
    margin-bottom: 0;
  }
  40% {
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
    max-height: 12rem;
  }
  100% {
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: -0.625rem;
    border-width: 0;
  }
}

/* --- Icon badge (signature element) --- */
.flash-toast__badge {
  flex-shrink: 0;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--flash-accent);
  color: #fff;
  font-size: 0.8125rem;
  box-shadow:
    0 1px 3px rgba(var(--flash-accent-rgb), 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* --- Body --- */
.flash-toast__body {
  flex: 1;
  min-width: 0;
  padding-top: 0.1875rem;
}

.flash-toast__text {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--flash-fg);
  letter-spacing: -0.006em;
}

.flash-toast__errors {
  margin: 0.5rem 0 0 0;
  padding: 0;
  list-style: none;
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--flash-fg-muted);
}

.flash-toast__errors li {
  position: relative;
  padding-left: 0.875rem;
  margin-bottom: 0.25rem;
}

.flash-toast__errors li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5625rem;
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 50%;
  background: var(--flash-accent);
  opacity: 0.6;
}

.flash-toast__errors li:last-child {
  margin-bottom: 0;
}

/* --- Close button --- */
.flash-toast__close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--flash-fg);
  opacity: 0.3;
  transition: opacity 0.2s ease, background 0.2s ease;
  font-size: 0.625rem;
  margin-top: 0.125rem;
  padding: 0;
}

.flash-toast__close:hover {
  opacity: 0.7;
  background: rgba(var(--flash-accent-rgb), 0.08);
}

.flash-toast__close:active {
  opacity: 0.9;
  transform: scale(0.92);
}

/* --- Progress bar --- */
.flash-toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(
    90deg,
    var(--flash-accent),
    rgba(var(--flash-accent-rgb), 0.7)
  );
  transform-origin: left;
  will-change: transform;
  box-shadow: 0 0 8px rgba(var(--flash-accent-rgb), 0.35);
}

/* ============================================
   Variant: Success
   ============================================ */
.flash-toast--success {
  --flash-accent: #059669;
  --flash-accent-rgb: 5, 150, 105;
  --flash-bg: #f0fdf4;
  --flash-border: #bbf7d0;
  --flash-fg: #14532d;
  --flash-fg-muted: #166534;
}

/* ============================================
   Variant: Alert / Error
   ============================================ */
.flash-toast--alert {
  --flash-accent: #dc2626;
  --flash-accent-rgb: 220, 38, 38;
  --flash-bg: #fef2f2;
  --flash-border: #fecaca;
  --flash-fg: #7f1d1d;
  --flash-fg-muted: #991b1b;
}

/* ============================================
   Variant: Validation Errors
   ============================================ */
.flash-toast--errors {
  --flash-accent: #dc2626;
  --flash-accent-rgb: 220, 38, 38;
  --flash-bg: #fef2f2;
  --flash-border: #fecaca;
  --flash-fg: #7f1d1d;
  --flash-fg-muted: #991b1b;
}

/* ============================================
   Responsive
   ============================================ */

/* Small phones */
@media (max-width: 374px) {
  .flash-toast {
    gap: 0.625rem;
    padding: 0.75rem;
    border-radius: 0.625rem;
  }

  .flash-toast__badge {
    width: 1.875rem;
    height: 1.875rem;
    font-size: 0.75rem;
    border-radius: 0.4375rem;
  }

  .flash-toast__text {
    font-size: 0.8125rem;
  }

  .flash-toast__body {
    padding-top: 0.125rem;
  }
}

/* Tablets and up */
@media (min-width: 768px) {
  .flash-toast {
    padding: 1rem 1.125rem;
  }

  .flash-toast__text {
    font-size: 0.875rem;
  }
}

/* Desktop */
@media (min-width: 992px) {
  .flash-toast {
    padding: 1rem 1.25rem;
    gap: 1rem;
    transition:
      box-shadow 0.25s ease;
  }

  .flash-toast--visible {
    transition:
      opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
      transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
      box-shadow 0.25s ease;
  }
}
