// Enhanced Loader Styles
.enhanced-loader-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;

  &.with-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 999999;
    
    [data-layout-mode="dark_mode"] & {
      background: rgba(29, 29, 66, 0.95);
    }
  }
}

.enhanced-loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

// Size variants
.small {
  transform: scale(0.7);
}

.medium {
  transform: scale(1);
}

.large {
  transform: scale(1.3);
}

// Color variants
.primary {
  --loader-color: #ff9f43;
  --loader-secondary: rgba(255, 159, 67, 0.3);
}

.success {
  --loader-color: #28a745;
  --loader-secondary: rgba(40, 167, 69, 0.3);
}

.danger {
  --loader-color: #dc3545;
  --loader-secondary: rgba(220, 53, 69, 0.3);
}

.info {
  --loader-color: #17a2b8;
  --loader-secondary: rgba(23, 162, 184, 0.3);
}

// Modern Ring Loader
.modern-loader {
  .loader-ring {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;

    div {
      box-sizing: border-box;
      display: block;
      position: absolute;
      width: 64px;
      height: 64px;
      margin: 8px;
      border: 8px solid var(--loader-color);
      border-radius: 50%;
      animation: modern-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
      border-color: var(--loader-color) transparent transparent transparent;

      &:nth-child(1) { animation-delay: -0.45s; }
      &:nth-child(2) { animation-delay: -0.3s; }
      &:nth-child(3) { animation-delay: -0.15s; }
    }
  }
}

@keyframes modern-ring {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

// Pulse Loader
.pulse-loader {
  display: flex;
  gap: 8px;

  .pulse-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--loader-color);
    animation: pulse-scale 1.4s ease-in-out infinite both;

    &:nth-child(1) { animation-delay: -0.32s; }
    &:nth-child(2) { animation-delay: -0.16s; }
    &:nth-child(3) { animation-delay: 0s; }
  }
}

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

// Wave Loader
.wave-loader {
  display: flex;
  gap: 4px;
  align-items: end;

  .wave-bar {
    width: 8px;
    height: 40px;
    background: var(--loader-color);
    border-radius: 4px;
    animation: wave-bounce 1.2s ease-in-out infinite;

    &:nth-child(1) { animation-delay: -1.1s; }
    &:nth-child(2) { animation-delay: -1.0s; }
    &:nth-child(3) { animation-delay: -0.9s; }
    &:nth-child(4) { animation-delay: -0.8s; }
    &:nth-child(5) { animation-delay: -0.7s; }
  }
}

@keyframes wave-bounce {
  0%, 40%, 100% {
    transform: scaleY(0.4);
  }
  20% {
    transform: scaleY(1.0);
  }
}

// Spinner Loader
.spinner-loader {
  .spinner-circle {
    width: 60px;
    height: 60px;
    border: 6px solid var(--loader-secondary);
    border-top: 6px solid var(--loader-color);
    border-radius: 50%;
    animation: spinner-rotate 1s linear infinite;
    position: relative;

    .spinner-inner {
      width: 30px;
      height: 30px;
      border: 3px solid var(--loader-secondary);
      border-top: 3px solid var(--loader-color);
      border-radius: 50%;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      animation: spinner-rotate 0.5s linear infinite reverse;
    }
  }
}

@keyframes spinner-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

// Dots Loader
.dots-loader {
  display: flex;
  gap: 6px;

  .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--loader-color);
    animation: dots-bounce 1.4s ease-in-out infinite both;

    &:nth-child(1) { animation-delay: -0.32s; }
    &:nth-child(2) { animation-delay: -0.16s; }
    &:nth-child(3) { animation-delay: 0s; }
    &:nth-child(4) { animation-delay: 0.16s; }
    &:nth-child(5) { animation-delay: 0.32s; }
  }
}

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

// Gradient Loader
.gradient-loader {
  .gradient-spinner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: conic-gradient(
      from 0deg,
      var(--loader-color),
      var(--loader-secondary),
      var(--loader-color)
    );
    animation: gradient-spin 1.5s linear infinite;
    position: relative;

    &::before {
      content: '';
      position: absolute;
      top: 6px;
      left: 6px;
      right: 6px;
      bottom: 6px;
      border-radius: 50%;
      background: white;
      
      [data-layout-mode="dark_mode"] & {
        background: #1d1d42;
      }
    }
  }
}

@keyframes gradient-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

// Bounce Loader
.bounce-loader {
  display: flex;
  gap: 8px;

  .bounce-ball {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--loader-color);
    animation: bounce-up-down 1.4s ease-in-out infinite both;

    &:nth-child(1) { animation-delay: -0.32s; }
    &:nth-child(2) { animation-delay: -0.16s; }
    &:nth-child(3) { animation-delay: 0s; }
  }
}

@keyframes bounce-up-down {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-30px);
  }
}

// Loader Text
.loader-text {
  text-align: center;
  
  .loading-message {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 10px;
    display: block;
    
    [data-layout-mode="dark_mode"] & {
      color: #ffffff;
    }
  }

  .progress-container {
    margin-top: 15px;
    width: 200px;

    .progress-bar {
      width: 100%;
      height: 6px;
      background: #e9ecef;
      border-radius: 3px;
      overflow: hidden;
      margin-bottom: 8px;
      
      [data-layout-mode="dark_mode"] & {
        background: #67748E;
      }

      .progress-fill {
        height: 100%;
        background: var(--loader-color);
        border-radius: 3px;
        transition: width 0.3s ease;
        background: linear-gradient(
          90deg,
          var(--loader-color),
          var(--loader-secondary),
          var(--loader-color)
        );
        background-size: 200% 100%;
        animation: progress-shimmer 2s ease-in-out infinite;
      }
    }

    .progress-text {
      font-size: 14px;
      color: #666;
      font-weight: 500;
      
      [data-layout-mode="dark_mode"] & {
        color: #67748E;
      }
    }
  }
}

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

// Responsive adjustments
@media (max-width: 768px) {
  .enhanced-loader-content {
    gap: 15px;
  }

  .small { transform: scale(0.6); }
  .medium { transform: scale(0.8); }
  .large { transform: scale(1); }

  .loader-text .loading-message {
    font-size: 14px;
  }

  .progress-container {
    width: 150px;
  }
}
