/* Enhanced Loader Styles - Replace the existing loader styles in style_form2.css */

#ajax-loader {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
}

.friendly-loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}

.friendly-loader-content {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  padding: 45px 35px;
  border-radius: 24px;
  text-align: center;
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  max-width: 420px;
  min-width: 340px;
  position: relative;
  animation: slideUp 0.4s ease-out;
}

.friendly-loader-animation {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 30px;
}

.pulse-circle {
  width: 100px;
  height: 100px;
  border: 3px solid #e2e8f0;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  animation: gentlePulse 2.5s ease-in-out infinite;
}

.rotating-dots {
  position: absolute;
  width: 100px;
  height: 100px;
  top: 0;
  left: 0;
  animation: rotate 3s linear infinite;
}

.rotating-dots .dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(45deg, #3b82f6, #8b5cf6);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.rotating-dots .dot-1 {
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  animation: dotPulse 1.5s ease-in-out infinite;
}

.rotating-dots .dot-2 {
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  animation: dotPulse 1.5s ease-in-out infinite 0.375s;
}

.rotating-dots .dot-3 {
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  animation: dotPulse 1.5s ease-in-out infinite 0.75s;
}

.rotating-dots .dot-4 {
  top: 50%;
  left: 5px;
  transform: translateY(-50%);
  animation: dotPulse 1.5s ease-in-out infinite 1.125s;
}

.loader-title {
  margin: 0 0 15px 0;
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.025em;
}

.loader-message {
  margin: 0 0 30px 0;
  font-size: 16px;
  color: #64748b;
  line-height: 1.5;
  font-weight: 400;
}

.progress-indicator {
  width: 100%;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4);
  background-size: 200% 100%;
  border-radius: 3px;
  width: 0;
  animation: 
    progressFill 3s ease-in-out infinite,
    gradientShift 2s ease-in-out infinite;
}

.progress-text {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
  animation: textPulse 2s ease-in-out infinite;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes gentlePulse {
  0%, 100% {
    transform: scale(1);
    border-color: #e2e8f0;
  }
  50% {
    transform: scale(1.05);
    border-color: #3b82f6;
  }
}

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

@keyframes dotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.7;
  }
}

@keyframes progressFill {
  0% {
    width: 0;
  }
  50% {
    width: 70%;
  }
  100% {
    width: 95%;
  }
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes textPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Body loading state enhancements */
body.loading {
  overflow: hidden;
}

body.loading .btn[role="button"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Responsive design */
@media (max-width: 768px) {
  .friendly-loader-content {
    margin: 20px;
    padding: 35px 25px;
    min-width: auto;
  }
  
  .loader-title {
    font-size: 22px;
  }
  
  .loader-message {
    font-size: 15px;
  }
  
  .friendly-loader-animation {
    width: 80px;
    height: 80px;
  }
  
  .pulse-circle,
  .rotating-dots {
    width: 80px;
    height: 80px;
  }
  
  .rotating-dots .dot {
    width: 10px;
    height: 10px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .friendly-loader-content {
    background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
  }
  
  .loader-title {
    color: #f1f5f9;
  }
  
  .loader-message,
  .progress-text {
    color: #cbd5e1;
  }
  
  .progress-bar {
    background: #475569;
  }
}

/* Accessibility - respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .friendly-loader-overlay,
  .friendly-loader-content {
    animation: none;
  }
  
  .pulse-circle,
  .rotating-dots,
  .rotating-dots .dot,
  .progress-fill,
  .progress-text {
    animation: none;
  }
  
  .friendly-loader-content::before {
    animation: none;
    background: #3b82f6;
  }
}