/* Enhanced Flash Messages */
.flash-message {
  display: flex;
  align-items: flex-start;
  margin: 20px 0;
  padding: 20px 24px;
  border-radius: 12px;
  border-left: 5px solid;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
  animation: flashSlideIn 0.3s ease-out;
  position: relative;
  background: #ffffff;
  min-height: 70px;
  transition: all 0.3s ease;
}

.flash-message:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Flash message types - using colors as accents */
.flash-success {
  border-left-color: #28a745;
  background: #ffffff;
  color: #2c3e50;
}

.flash-danger {
  border-left-color: #dc3545;
  background: #ffffff;
  color: #2c3e50;
}

.flash-warning {
  border-left-color: #ffc107;
  background: #ffffff;
  color: #2c3e50;
}

.flash-info {
  border-left-color: #17a2b8;
  background: #ffffff;
  color: #2c3e50;
}

.flash-secondary {
  border-left-color: #6c757d;
  background: #ffffff;
  color: #2c3e50;
}

/* Flash content layout */
.flash-content {
  display: flex;
  align-items: flex-start;
  width: 100%;
  gap: 16px;
}

.flash-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
}

.flash-icon i {
  font-size: 20px;
  opacity: 1;
}

.flash-success .flash-icon {
  background: rgba(40, 167, 69, 0.1);
}

.flash-success .flash-icon i {
  color: #28a745;
}

.flash-danger .flash-icon {
  background: rgba(220, 53, 69, 0.1);
}

.flash-danger .flash-icon i {
  color: #dc3545;
}

.flash-warning .flash-icon {
  background: rgba(255, 193, 7, 0.1);
}

.flash-warning .flash-icon i {
  color: #ffc107;
}

.flash-info .flash-icon {
  background: rgba(23, 162, 184, 0.1);
}

.flash-info .flash-icon i {
  color: #17a2b8;
}

.flash-secondary .flash-icon {
  background: rgba(108, 117, 125, 0.1);
}

.flash-secondary .flash-icon i {
  color: #6c757d;
}

.flash-text {
  flex: 1;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 500;
  padding-top: 3px;
}

/* Close button */
.flash-close {
  background: none;
  border: none;
  padding: 6px;
  margin: -6px -6px -6px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  opacity: 0.6;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flash-close:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.08);
  transform: scale(1.1);
}

.flash-close:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
  opacity: 1;
}

.flash-close i {
  font-size: 16px;
  color: #6c757d;
}

/* Animations */
@keyframes flashSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flashSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
    margin: 15px 0;
    padding: 16px 20px;
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
    margin: 0;
    padding: 0 20px;
  }
}

.flash-message.flash-dismissing {
  animation: flashSlideOut 0.3s ease-in forwards;
}

/* Container for flash messages */
.flash-messages-container {
  position: relative;
  margin-bottom: 20px;
}

/* Auto-dismiss styling */
.flash-message.auto-dismiss::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.3;
  animation: flashProgress 20s linear;
}

@keyframes flashProgress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .flash-message {
    border-width: 3px;
    border-style: solid;
    border-color: currentColor;
  }
  
  .flash-success {
    border-left-color: #28a745;
    background: #ffffff;
  }
  
  .flash-danger {
    border-left-color: #dc3545;
    background: #ffffff;
  }
  
  .flash-warning {
    border-left-color: #ffc107;
    background: #ffffff;
  }
  
  .flash-info {
    border-left-color: #17a2b8;
    background: #ffffff;
  }
  
  .flash-secondary {
    border-left-color: #6c757d;
    background: #ffffff;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .flash-message {
    animation: none;
  }
  
  .flash-message:hover {
    transform: none;
  }
  
  .flash-close:hover {
    transform: none;
  }
  
  .flash-message.flash-dismissing {
    animation: none;
    display: none;
  }
  
  .flash-message.auto-dismiss::after {
    animation: none;
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .flash-message {
    margin: 15px 0;
    padding: 18px 20px;
    border-radius: 10px;
  }
  
  .flash-content {
    gap: 14px;
  }
  
  .flash-text {
    font-size: 15px;
  }
  
  .flash-icon {
    width: 26px;
    height: 26px;
  }
  
  .flash-icon i {
    font-size: 18px;
  }
  
  .flash-close {
    width: 32px;
    height: 32px;
    margin: -4px -4px -4px 8px;
  }
  
  .flash-close i {
    font-size: 14px;
  }
}

/* Print styles */
@media print {
  .flash-message {
    box-shadow: none;
    border: 1px solid currentColor;
    background: transparent !important;
  }
  
  .flash-close {
    display: none;
  }
}

/* Focus management for screen readers */
.flash-message[role="alert"] {
  /* Ensure screen readers announce the message */
}

/* Loading state for dynamic flash messages */
.flash-message.loading {
  opacity: 0.7;
  pointer-events: none;
}

.flash-message.loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: flashLoading 1.5s infinite;
}

@keyframes flashLoading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}
