/* Standardized Flash Messages System */
/* Consistent styling for all flash messages across the application */

/* Flash Messages Container */
.flash-messages-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: min(400px, calc(100vw - 40px));
  pointer-events: none; /* Allow clicks to pass through container */
}

.flash-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto; /* Re-enable pointer events for messages */
}

/* Individual Flash Message */
.flash-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05));
  animation: slideInRight 0.3s ease-out;
  border-left: 4px solid;
  position: relative;
  backdrop-filter: blur(8px);
  min-height: 56px;
  opacity: 1 !important;
  width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Success Messages (Green) */
.flash-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-left-color: #047857;
  opacity: 1 !important;
}

.flash-success .flash-icon-svg {
  color: #d1fae5;
}

/* Info Messages (Blue) */
.flash-info {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border-left-color: #1e40af;
  opacity: 1 !important;
}

.flash-info .flash-icon-svg {
  color: #dbeafe;
}

/* Error Messages (Red) - Also handle 'danger' category */
.flash-error,
.flash-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border-left-color: #b91c1c;
  opacity: 1 !important;
}

.flash-error .flash-icon-svg,
.flash-danger .flash-icon-svg {
  color: #fecaca;
}

/* Warning Messages (Orange) - Also handle 'warning' category */
.flash-warning {
  background: linear-gradient(135deg, #ffe000 0%, #ffe000 100%);
  color: white;
  border-left-color: #ffe000;
  opacity: 1 !important;
}

.flash-warning .flash-icon-svg {
  color: #ffe000;
}

/* Flash Message Icon */
.flash-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-top: 2px;
}

.flash-icon-svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* Flash Message Content */
.flash-content {
  flex: 1;
  min-width: 0; /* Allow text to wrap */
}

.flash-text {
  font-weight: 600;
  line-height: 1.5;
  word-wrap: break-word;
  display: block;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Close Button */
.flash-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm, 4px);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: -2px;
}

.flash-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.flash-close:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.flash-close:active {
  transform: scale(0.95);
}

.flash-close-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

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

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .flash-messages-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .flash-message {
    padding: 14px 16px;
    min-height: 52px;
  }
  
  .flash-text {
    font-size: 14px;
  }
  
  .flash-icon {
    width: 20px;
    height: 20px;
  }
  
  .flash-icon-svg {
    width: 18px;
    height: 18px;
  }
  
  .flash-close {
    width: 24px;
    height: 24px;
  }
  
  .flash-close-icon {
    width: 14px;
    height: 14px;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .flash-messages-container {
    top: 5px;
    right: 5px;
    left: 5px;
  }
  
  .flash-message {
    padding: 12px 14px;
    min-height: 48px;
  }
  
  .flash-text {
    font-size: 13px;
    line-height: 1.4;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .flash-message {
    border: 2px solid currentColor;
  }
  
  .flash-success {
    background: #059669;
    border-color: #ffffff;
  }
  
  .flash-info {
    background: #1d4ed8;
    border-color: #ffffff;
  }
  
  .flash-error,
  .flash-danger {
    background: #ffe000;
    border-color: #ffffff;
  }
  
  .flash-warning {
    background: #ffe000;
    border-color: #ffffff;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .flash-message {
    animation: none;
  }
  
  .flash-close {
    transition: none;
  }
  
  .flash-close:hover {
    transform: none;
  }
  
  .flash-close:active {
    transform: none;
  }
}

/* Dark Mode Support (if implemented) */
@media (prefers-color-scheme: dark) {
  .flash-message {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  }
}

/* Focus Management for Accessibility */
.flash-message:focus-within {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* Ensure proper stacking on different z-index layers */
.flash-messages-container {
  z-index: 9999;
}

/* Print Styles */
@media print {
  .flash-messages-container {
    display: none;
  }
}
