/* Turbo Drive Progress Indicator Styles */
.turbo-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background-color: #0d6efd; /* Bootstrap primary blue */
  z-index: 1060;
  transition: width 300ms ease-out, opacity 150ms ease-in;
  transform: translate3d(0, 0, 0);
}

/* Fullscreen loading overlay for longer page loads */
.turbo-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 1059;
  display: none; /* Changed from flex to none by default */
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Show overlay after a short delay to avoid flashing on fast page loads */
.turbo-loading-overlay.visible {
  display: flex !important;
  opacity: 1;
}

/* Dark mode support */
body.dark-mode .turbo-loading-overlay,
html.theme-dark .turbo-loading-overlay {
  background-color: rgba(33, 37, 41, 0.8);
}

body.dark-mode .turbo-progress-bar,
html.theme-dark .turbo-progress-bar {
  background-color: #0dcaf0; /* Bootstrap info color */
}

/* Spinner styling based on your existing spinner */
.turbo-loading-spinner {
  width: 3rem;
  height: 3rem;
  border: 0.25em solid rgba(13, 110, 253, 0.25);
  border-right-color: #0d6efd;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

/* Allow spinner animation even when transitions are globally disabled */
html.no-transitions .turbo-loading-spinner {
  animation: spinner-border 0.75s linear infinite !important;
}

body.dark-mode .turbo-loading-spinner,
html.theme-dark .turbo-loading-spinner {
  border-color: rgba(13, 202, 240, 0.25);
  border-right-color: #0dcaf0;
}

@keyframes turbo-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.turbo-fade-in {
  animation: turbo-fade-in 0.2s ease-in-out;
}

/* Prevent layout shift and flicker for permanent elements during Turbo navigation */
[data-turbo-permanent] {
  opacity: 1 !important;
  visibility: visible !important;
  animation: none !important;
  transition: none !important;
}
