/* Wave 4 Issue 32: message/feedback UX polish */
.messages-container {
  position: sticky;
  top: clamp(0.75rem, 2vw, 1.25rem);
  z-index: 1150;
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1rem;
  pointer-events: none;
}

.flash {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  width: min(100%, 920px);
  margin-inline: auto;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  color: #0f172a;
  line-height: 1.8;
  overflow-wrap: anywhere;
  animation: feedbackSlideIn 180ms ease-out;
}

.flash-body {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

.flash-icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  font-weight: 800;
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
}

.flash-text {
  min-width: 0;
}

.flash-close {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #475569;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.flash-close:hover,
.flash-close:focus-visible {
  background: rgba(15, 23, 42, 0.12);
  color: #0f172a;
  outline: none;
}

.flash-success,
.flash.success {
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(240, 253, 244, 0.98);
}
.flash-success .flash-icon,
.flash.success .flash-icon {
  background: rgba(22, 163, 74, 0.14);
  color: #15803d;
}

.flash-error,
.flash-danger,
.flash.error,
.flash.danger {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(254, 242, 242, 0.98);
}
.flash-error .flash-icon,
.flash-danger .flash-icon,
.flash.error .flash-icon,
.flash.danger .flash-icon {
  background: rgba(220, 38, 38, 0.14);
  color: #b91c1c;
}

.flash-warning,
.flash.warning {
  border-color: rgba(217, 119, 6, 0.28);
  background: rgba(255, 251, 235, 0.98);
}
.flash-warning .flash-icon,
.flash.warning .flash-icon {
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
}

.flash-info,
.flash.info {
  border-color: rgba(2, 132, 199, 0.24);
  background: rgba(240, 249, 255, 0.98);
}
.flash-info .flash-icon,
.flash.info .flash-icon {
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
}

.flash.is-hiding {
  opacity: 0;
  transform: translateY(-0.35rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

@keyframes feedbackSlideIn {
  from { opacity: 0; transform: translateY(-0.4rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .messages-container {
    position: fixed;
    top: max(0.75rem, env(safe-area-inset-top));
    inset-inline: 0.75rem;
    margin: 0;
  }

  .flash {
    width: 100%;
    padding: 0.8rem;
    border-radius: 0.9rem;
    font-size: 0.92rem;
  }

  .flash-icon {
    width: 1.65rem;
    height: 1.65rem;
  }

  .flash-close {
    width: 1.85rem;
    height: 1.85rem;
  }
}

@media print {
  .messages-container {
    display: none !important;
  }
}
