/**
 * @fileoverview Styling for yaze WASM loading indicators
 *
 * Provides smooth, modern loading UI with animations and responsive design
 */

/* Loading overlay - full screen with semi-transparent background */
.yaze-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  pointer-events: none;
}

.yaze-loading-overlay.yaze-loading-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Loading container - centered box with content */
.yaze-loading-container {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  border-radius: 12px;
  padding: 32px;
  min-width: 400px;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
              0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: slideUp 0.4s ease-out;
}

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

/* Task name heading */
.yaze-loading-task {
  color: #ecf0f1;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 20px 0;
  text-align: center;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Progress container */
.yaze-progress-container {
  position: relative;
  margin-bottom: 16px;
}

/* Progress bar background */
.yaze-progress-bar {
  height: 24px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Progress fill */
.yaze-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2980b9);
  border-radius: 12px;
  position: relative;
  width: 0%;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

.yaze-progress-fill.yaze-progress-animated {
  transition: width 0.3s ease-out;
}

/* Animated stripes on progress bar */
.yaze-progress-fill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.1) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.1) 75%,
    transparent 75%,
    transparent
  );
  background-size: 40px 40px;
  animation: progressStripes 1s linear infinite;
}

@keyframes progressStripes {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 40px 40px;
  }
}

/* Progress text percentage */
.yaze-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ecf0f1;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  z-index: 1;
  pointer-events: none;
}

/* Status message */
.yaze-loading-message {
  color: #bdc3c7;
  font-size: 14px;
  margin: 12px 0 16px 0;
  text-align: center;
  min-height: 20px;
  line-height: 1.4;
}

/* Cancel button */
.yaze-cancel-button {
  display: inline-block;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  margin: 8px auto 0;
  display: block;
}

.yaze-cancel-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.yaze-cancel-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.yaze-cancel-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: linear-gradient(135deg, #7f8c8d, #95a5a6);
}

/* Pulse animation for long operations */
@keyframes pulse {
  0% {
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
  }
  50% {
    box-shadow: 0 2px 16px rgba(52, 152, 219, 0.6);
  }
  100% {
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
  }
}

.yaze-progress-fill:not(.yaze-progress-animated) {
  animation: pulse 2s ease-in-out infinite;
}

/* Responsive design for smaller screens */
@media (max-width: 600px) {
  .yaze-loading-container {
    min-width: 90%;
    max-width: 90%;
    padding: 24px;
    margin: 16px;
  }

  .yaze-loading-task {
    font-size: 18px;
  }

  .yaze-progress-bar {
    height: 20px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .yaze-loading-overlay {
    background-color: rgba(0, 0, 0, 0.8);
  }

  .yaze-loading-container {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .yaze-loading-container {
    border: 2px solid white;
  }

  .yaze-progress-bar {
    border: 1px solid white;
  }

  .yaze-cancel-button {
    border: 2px solid white;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .yaze-loading-overlay,
  .yaze-progress-fill {
    transition: none;
  }

  .yaze-loading-container {
    animation: none;
  }

  .yaze-progress-fill::before {
    animation: none;
  }

  .yaze-progress-fill:not(.yaze-progress-animated) {
    animation: none;
  }
}