/* Loader Styles */

/* Full page loader overlay */
.page-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease-in-out;
}

/* Ensure only one loader is visible at a time */
.page-loader-overlay ~ .page-loader-overlay {
  display: none !important;
}

/* Prevent header blinking during navigation */
.header-wrap {
  position: relative;
  z-index: 1000;
  transition: none !important;
}

/* Prevent header elements from blinking */
.header-wrap * {
  transition: color 0.3s ease, background-color 0.3s ease !important;
}

/* Ensure loaders don't interfere with header */
.page-loader-overlay {
  z-index: 999;
}

/* Prevent multiple loaders from stacking */
body > .page-loader-overlay:not(:first-of-type) {
  display: none !important;
}

/* Section loader */
.section-loader {
  min-height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

/* Spinner animation enhancement */
.spinner-border {
  animation-duration: 0.8s;
}

/* Pulse animation for loaders */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(51, 143, 122, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(51, 143, 122, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(51, 143, 122, 0);
  }
}

.pulse-loader {
  animation: pulse 2s infinite;
}

/* Skeleton loading animation */
.skeleton-loader {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Card skeleton */
.card-skeleton {
  height: 200px;
  border-radius: 8px;
}

/* Text skeleton */
.text-skeleton {
  height: 20px;
  margin-bottom: 10px;
  width: 100%;
  border-radius: 4px;
}

.text-skeleton.title {
  height: 30px;
  width: 70%;
}

.text-skeleton.subtitle {
  width: 50%;
}

/* Image skeleton */
.image-skeleton {
  aspect-ratio: 16/9;
  border-radius: 8px;
}

/* Circle skeleton for avatars */
.circle-skeleton {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

/* Fade-in animation for content */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Z-index management */
.z-1050 {
  z-index: 1050;
}

/* Loader for specific components */
.map-loader,
.chart-loader,
.table-loader {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(248, 249, 250, 0.7);
  border-radius: 8px;
}

/* Spinner sizes */
.spinner-border-lg {
  width: 3rem;
  height: 3rem;
}

/* Loader message styling */
.loader-message {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #666;
}

/* Loader for dark theme */
[data-bs-theme="dark"] .page-loader-overlay {
  background-color: rgba(33, 37, 41, 0.8);
}

[data-bs-theme="dark"] .section-loader {
  background-color: rgba(33, 37, 41, 0.5);
}

[data-bs-theme="dark"] .skeleton-loader {
  background: linear-gradient(90deg, #2c3034 25%, #212529 50%, #2c3034 75%);
}

[data-bs-theme="dark"] .loader-message {
  color: #adb5bd;
}
