/* ============================================
   LOADING & SKELETON STATES
   Fast Loading Animations & Smooth Transitions
   ============================================ */

/* Page Loading Animation */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  animation: fadeOut 0.6s ease-out 1s forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    pointer-events: auto;
  }
  to {
    opacity: 0;
    pointer-events: none;
  }
}

/* Spinner Loading Animation */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Skeleton Loaders */
.skeleton-container {
  animation: pulseLoad 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseLoad {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmerLoad 1.5s infinite;
  border-radius: 4px;
}

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

/* Card Loading Animation */
.skeleton-card {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.skeleton-card .skeleton-line {
  height: 12px;
  margin-bottom: 10px;
  border-radius: 4px;
  animation: shimmerLoad 1.5s infinite;
}

.skeleton-card .skeleton-line.full {
  width: 100%;
}

.skeleton-card .skeleton-line.half {
  width: 50%;
}

/* Content Fade-In */
.content-fade-in {
  animation: contentFadeIn 0.6s ease-out forwards;
  opacity: 0;
}

@keyframes contentFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-fade-in:nth-child(1) { animation-delay: 0.1s; }
.content-fade-in:nth-child(2) { animation-delay: 0.2s; }
.content-fade-in:nth-child(3) { animation-delay: 0.3s; }
.content-fade-in:nth-child(4) { animation-delay: 0.4s; }
.content-fade-in:nth-child(5) { animation-delay: 0.5s; }

/* Progress Bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
  animation: progressBarMove 2s ease-in-out infinite;
  z-index: 9999;
}

@keyframes progressBarMove {
  0% {
    width: 0%;
  }
  50% {
    width: 80%;
  }
  100% {
    width: 100%;
  }
}

/* Image Loading State */
.image-loading {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmerLoad 1.5s infinite;
  aspect-ratio: 16/9;
}

.image-loaded {
  animation: imageLoad 0.5s ease-out forwards;
}

@keyframes imageLoad {
  from {
    opacity: 0;
    filter: blur(10px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

/* Button Loading State */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Pulse Dot Loading */
.pulse-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.pulse-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulseDot 1.4s infinite;
}

.pulse-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.pulse-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulseDot {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  30% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* Floating Character Animation */
.floating-char {
  animation: floatChar 3s ease-in-out infinite;
}

@keyframes floatChar {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Staggered List Loading */
.stagger-load {
  opacity: 0;
  animation: staggerInUp 0.6s ease-out forwards;
}

.stagger-load:nth-child(1) { animation-delay: 0s; }
.stagger-load:nth-child(2) { animation-delay: 0.1s; }
.stagger-load:nth-child(3) { animation-delay: 0.2s; }
.stagger-load:nth-child(4) { animation-delay: 0.3s; }
.stagger-load:nth-child(5) { animation-delay: 0.4s; }
.stagger-load:nth-child(6) { animation-delay: 0.5s; }
.stagger-load:nth-child(7) { animation-delay: 0.6s; }
.stagger-load:nth-child(8) { animation-delay: 0.7s; }
.stagger-load:nth-child(9) { animation-delay: 0.8s; }
.stagger-load:nth-child(10) { animation-delay: 0.9s; }

@keyframes staggerInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Glow Effect on Load */
.glow-load {
  animation: glowLoad 2s ease-in-out infinite;
}

@keyframes glowLoad {
  0%, 100% {
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
  }
  50% {
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.5);
  }
}

/* Smooth Scroll to Top */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.scroll-to-top.show {
  display: flex;
  opacity: 1;
  animation: popUp 0.4s ease-out;
}

@keyframes popUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Smooth Loading Check */
.check-mark {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
}

.check-mark::after {
  content: "";
  position: absolute;
  display: none;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 12px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  animation: checkmark 0.6s ease-out;
}

@keyframes checkmark {
  from {
    opacity: 0;
    transform: rotate(-45deg);
  }
  to {
    opacity: 1;
    transform: rotate(45deg);
  }
}

/* Intersection Observer Animations */
.reveal {
  opacity: 0;
  animation: reveal 0.8s ease-out forwards;
}

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

/* Modal Open Animation */
.modal-open {
  animation: modalBackgroundEnter 0.3s ease-out;
}

@keyframes modalBackgroundEnter {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(5px);
  }
}

.modal-content {
  animation: modalContentEnter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalContentEnter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: toastIn 0.3s ease-out, toastOut 0.3s ease-out 3.7s forwards;
  z-index: 10000;
}

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

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

/* Smooth Route Transition */
.route-enter {
  animation: routeEnter 0.5s ease-out;
}

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

.route-exit {
  animation: routeExit 0.5s ease-out forwards;
}

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

/* Line Draw Animation */
.line-draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: lineDraw 2s ease-out forwards;
}

@keyframes lineDraw {
  to {
    stroke-dashoffset: 0;
  }
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
