/* =============================================================================
   Screen Transition Styles
   ============================================================================= */

/* Base transition */
.screen {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Entering animation */
.screen.entering {
  animation: slideInRight 0.3s ease forwards;
}

/* Exiting animation */
.screen.exiting {
  animation: slideOutLeft 0.3s ease forwards;
}

/* Back navigation (reverse direction) */
.screen.entering-back {
  animation: slideInLeft 0.3s ease forwards;
}

.screen.exiting-back {
  animation: slideOutRight 0.3s ease forwards;
}

/* Direction-specific classes (used by Router) */
.screen.enter-right {
  animation: slideInRight 0.3s ease forwards;
}

.screen.enter-left {
  animation: slideInLeft 0.3s ease forwards;
}

.screen.exit-left {
  animation: slideOutLeft 0.3s ease forwards;
}

.screen.exit-right {
  animation: slideOutRight 0.3s ease forwards;
}

/* Keyframe animations */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-30px);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

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

/* Route loading indicator */
.route-loading-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.route-loading-indicator.visible {
  opacity: 1;
  visibility: visible;
}

.route-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--papyrus-gold, #D4AF37);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Overlay when loading */
body.route-loading::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.route-loading::before {
  opacity: 1;
  visibility: visible;
}

/* Route error indicator */
.route-error-indicator {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.route-error-indicator.visible {
  opacity: 1;
  visibility: visible;
}

.route-error-content {
  background: var(--red-grade, #FF4444);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
}

.route-error-icon {
  font-size: 24px;
}

.route-error-message {
  flex: 1;
  font-weight: 500;
}

.route-error-dismiss {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.route-error-dismiss:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .screen,
  .screen.entering,
  .screen.exiting,
  .screen.entering-back,
  .screen.exiting-back {
    animation: none;
    transition: opacity 0.15s ease;
  }

  .skeleton,
  .screen-loading::after {
    animation: none;
  }
}
