/*
 * /public/css/components/alerts.css
 * Unified styling for all flash messages (server and client-side).
 */

/* Container for all flash messages */
#flash-container {
  position: fixed;
  top: 80px; /* Position below the member header */
  right: 20px;
  z-index: 12000;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Base style for a single alert */
.flash-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: slideInRight 0.4s ease-out forwards;
  opacity: 0;
  transform: translateX(20px);
}

.flash-alert.fade-out {
  animation: fadeOutRight 0.5s ease-in forwards;
}

/* Alert icon */
.flash-alert__icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  margin-top: 2px;
}

/* Alert message */
.flash-alert__message {
  flex-grow: 1;
  font-size: 0.95rem;
  line-height: 1.5;
}
.flash-alert__message strong {
  font-weight: var(--font-weight-semibold);
}

/* Close button */
.flash-alert__close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 0 0 0.5rem;
  margin-top: -2px;
  transition: opacity 0.2s ease;
}

.flash-alert__close:hover {
  opacity: 1;
}

/* Color Variants */
.flash-alert[data-type="success"] {
  background-color: var(--color-success-light);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--color-success-dark);
}

.flash-alert[data-type="danger"] {
  background-color: var(--color-danger-light);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--color-danger-dark);
}

.flash-alert[data-type="warning"] {
  background-color: var(--color-warning-light);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--color-warning-dark);
}

.flash-alert[data-type="info"] {
  background-color: var(--color-info-light);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--color-info-dark);
}

/* Animations */
@keyframes slideInRight {
  to {
      opacity: 1;
      transform: translateX(0);
  }
}

@keyframes fadeOutRight {
  from {
      opacity: 1;
      transform: translateX(0);
  }
  to {
      opacity: 0;
      transform: translateX(20px);
  }
}

/* Responsive adjustments */
@media (max-width: 767px) {
  #flash-container {
    top: 70px;
    left: 15px;  /* Increased spacing from the left edge */
    right: 15px; /* Increased spacing from the right edge */
    width: auto; /* This is the key change to prevent overflow */
    max-width: none;
  }

  .flash-alert {
    /* Slightly reduce padding on very small screens for better text flow */
    padding: 0.875rem 1rem;
  }

  .flash-alert__message {
    /* Improve font size for readability on mobile */
    font-size: 0.9rem;
  }
}

/* Styling for links inside flash alerts to make them more visible */
.flash-alert__link {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  background-color: rgba(0, 0, 0, 0.25);
  padding: 0.2em 0.5em;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.flash-alert__link:hover,
.flash-alert__link:focus {
  background-color: rgba(0, 0, 0, 0.4); /* Darker still on hover */
  color: #fff; /* Explicitly keep text white on hover */
  text-decoration: none; /* Ensure no underline appears on hover */
}