/* Enhanced Loading Animation */
#page-loader {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#page-loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-container {
  text-align: center;
  position: relative;
}

/* Main Spinner */
.loader-spinner {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  position: relative;
}

.loader-spinner .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid transparent;
  animation: loader-spin 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.loader-spinner .ring:nth-child(1) {
  border-top-color: #1d4ed8;
  animation-delay: 0s;
}

.loader-spinner .ring:nth-child(2) {
  inset: 8px;
  border-right-color: #2563eb;
  animation-delay: 0.15s;
  animation-direction: reverse;
}

.loader-spinner .ring:nth-child(3) {
  inset: 16px;
  border-bottom-color: #3b82f6;
  animation-delay: 0.3s;
}

/* Logo in Center */
.loader-logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  animation: loader-pulse 1.5s ease-in-out infinite;
}

/* Loading Text */
.loader-text {
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 24px;
  animation: loader-fade 1.5s ease-in-out infinite;
}

.loader-text::after {
  content: '...';
  animation: loader-dots 1.5s steps(4, end) infinite;
}

/* Animations */
@keyframes loader-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes loader-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes loader-fade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes loader-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

/* Alternative: Dots Loader */
.loader-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}

.loader-dots .dot {
  width: 12px;
  height: 12px;
  background: #1d4ed8;
  border-radius: 50%;
  animation: loader-bounce 1.4s ease-in-out infinite both;
}

.loader-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dots .dot:nth-child(2) { animation-delay: -0.16s; }
.loader-dots .dot:nth-child(3) { animation-delay: 0s; }

@keyframes loader-bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Progress Bar Style */
.loader-progress {
  width: 200px;
  height: 3px;
  background: #e5e7eb;
  border-radius: 3px;
  margin: 20px auto 0;
  overflow: hidden;
  position: relative;
}

.loader-progress::after {
  content: '';
  position: absolute;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, #1d4ed8, #2563eb, #3b82f6);
  border-radius: 3px;
  animation: loader-progress 1.5s ease-in-out infinite;
}

@keyframes loader-progress {
  0% { left: -50%; }
  100% { left: 100%; }
}

/* Responsive */
@media (max-width: 768px) {
  .loader-spinner {
    width: 60px;
    height: 60px;
  }
  
  .loader-spinner .ring:nth-child(2) {
    inset: 6px;
  }
  
  .loader-spinner .ring:nth-child(3) {
    inset: 12px;
  }
  
  .loader-logo img {
    width: 32px;
    height: 32px;
  }
  
  .loader-text {
    font-size: 12px;
    letter-spacing: 1.5px;
  }
}