/* Copyright 2026 Renofy Ltd. All rights reserved. */
/* === Django Messages — modern toast overlay ===
   White card + coloured severity icon (Sonner / Apple / Stripe family).
   Floats above page chrome so it never displaces content. Auto-dismisses
   after ~4s; pauses while the user hovers/focuses so they have time to read. */

.messages-container {
  position: fixed;
  top: calc(var(--height-header) + env(safe-area-inset-top, 0px) + 1rem);
  left: 0;
  right: 0;
  z-index: var(--z-index-critical);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  /* container is click-through; only the alerts themselves catch pointer events */
  pointer-events: none;
}

.alert {
  pointer-events: auto;
  /* Mobile: 1rem inset each side. Desktop hits the 480px cap before this
     calc kicks in, so desktop side spacing is unaffected by the value here. */
  width: min(calc(100vw - 2rem), 480px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  /* Layered shadow for soft, iOS-style elevation. */
  box-shadow: 0 12px 28px rgba(14, 17, 22, 0.10),
              0 4px 10px rgba(14, 17, 22, 0.06),
              0 0 0 0.5px rgba(14, 17, 22, 0.04);
  animation: alert-toast 4s ease-in-out forwards;
}

/* Pause the auto-dismiss timer while the user is interacting with the toast. */
.alert:hover,
.alert:focus-within {
  animation-play-state: paused;
}

.alert__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert__content {
  flex: 1;
  min-width: 0; /* allow long messages to wrap rather than overflow */
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  line-height: 1.4;
}

/* === Severity — colours only the icon, card stays neutral. */

.alert-success .alert__icon { color: var(--color-success); }
.alert-error   .alert__icon { color: var(--color-danger); }
.alert-warning .alert__icon { color: var(--color-warning); }
.alert-info    .alert__icon { color: var(--color-info); }
.alert-debug   .alert__icon { color: var(--color-text-secondary); }

/* === Animation === */

@keyframes alert-toast {
  0%   { opacity: 0; transform: translateY(-12px); }
  6%   { opacity: 1; transform: translateY(0); }
  94%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-12px); visibility: hidden; }
}

@keyframes alert-toast-fade {
  0%, 6%  { opacity: 0; }
  8%, 92% { opacity: 1; }
  100%    { opacity: 0; visibility: hidden; }
}

/* Honour OS-level reduced-motion preference — drop the slide, keep the fade. */
@media (prefers-reduced-motion: reduce) {
  .alert {
    animation-name: alert-toast-fade;
  }
}
