/* ==============================================================
   Professional Loading Animation - Customevo
   ============================================================== */

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

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

@keyframes dots {
  0%,
  20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%,
  100% {
    content: '...';
  }
}

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

/* Main loading container */
.app-loading {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
  z-index: 9999;
}

/* Loading content wrapper */
.app-loading-content {
  text-align: center;
  padding: 2rem;
}

/* Brand logo container */
.loading-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  box-shadow: 0 20px 25px -5px rgba(30, 58, 138, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

/* Logo icon */
.loading-logo-icon {
  width: 40px;
  height: 40px;
  color: white;
}

/* Spinner ring */
.spinner-ring {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.spinner-ring::before,
.spinner-ring::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}

.spinner-ring::before {
  border-top-color: #1e3a8a;
  border-right-color: #1e3a8a;
  animation: spin 1s linear infinite;
}

.spinner-ring::after {
  border-bottom-color: #f59e0b;
  border-left-color: #f59e0b;
  animation: spin 1.5s linear infinite reverse;
}

/* Loading text */
.app-loading h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem;
  letter-spacing: -0.025em;
}

.app-loading p {
  font-size: 1rem;
  color: #64748b;
  margin: 0;
  font-weight: 500;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(3, end) infinite;
}

/* Progress bar */
.loading-progress {
  width: 200px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin: 1.5rem auto 0;
  overflow: hidden;
  position: relative;
}

.loading-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #1e3a8a, #3b82f6, #1e3a8a);
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
  border-radius: 2px;
}

/* Loading stages */
.loading-stages {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.loading-stage {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: #94a3b8;
  transition: all 0.3s ease;
}

.loading-stage.active {
  color: #1e3a8a;
  font-weight: 600;
}

.loading-stage.completed {
  color: #059669;
}

.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: all 0.3s ease;
}

.loading-stage.active .stage-dot {
  background: #1e3a8a;
  box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

.loading-stage.completed .stage-dot {
  background: #059669;
}

/* Skeleton shimmer effect for content loading */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.375rem;
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text-short {
  width: 60%;
}

.skeleton-title {
  height: 1.5rem;
  width: 80%;
  margin-bottom: 1rem;
}

.skeleton-card {
  height: 200px;
  margin-bottom: 1rem;
}

.skeleton-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

/* Backwards compatibility - hide old pacman */
.lds-pacman {
  display: none !important;
}

/* Error state */
.app-loading #app-error {
  max-width: 600px;
  padding: 2rem;
  text-align: center;
}

.app-loading #app-error h1 {
  font-size: 1.5rem;
  color: #dc2626;
  margin-bottom: 1rem;
}

.app-loading #app-error h2 {
  font-size: 1.125rem;
  color: #374151;
  margin: 1.5rem 0 0.75rem;
}

.app-loading #app-error ol {
  text-align: left;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.app-loading #app-error li {
  margin-bottom: 0.5rem;
}

.app-loading #app-error code {
  background: #fee2e2;
  color: #dc2626;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 480px) {
  .app-loading h1 {
    font-size: 1.5rem;
  }

  .app-loading p {
    font-size: 0.875rem;
  }

  .loading-logo {
    width: 64px;
    height: 64px;
  }

  .loading-logo-icon {
    width: 32px;
    height: 32px;
  }
}
