/* web/app/utils/loading.css */
/* ✅ FASE 1: Estilos para sistema de Loading States */

/* ===== SPINNER ===== */
.loading-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 40px;
  height: 40px;
}

.loading-spinner--small {
  width: 20px;
  height: 20px;
}

.loading-spinner--medium {
  width: 40px;
  height: 40px;
}

.loading-spinner--large {
  width: 60px;
  height: 60px;
}

.loading-spinner__ring {
  position: absolute;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
  width: 100%;
  height: 100%;
}

.loading-spinner__ring:nth-child(2) {
  animation-delay: -0.2s;
  border-width: 2px;
  width: 70%;
  height: 70%;
  top: 15%;
  left: 15%;
}

.loading-spinner__ring:nth-child(3) {
  animation-delay: -0.4s;
  border-width: 1px;
  width: 40%;
  height: 40%;
  top: 30%;
  left: 30%;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== SKELETON SCREEN ===== */
.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  animation: loading-skeleton-pulse 1.5s ease-in-out infinite;
}

.loading-skeleton__line {
  background: linear-gradient(
    90deg,
    rgba(59, 130, 246, 0.1) 0%,
    rgba(59, 130, 246, 0.2) 50%,
    rgba(59, 130, 246, 0.1) 100%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  animation: loading-skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes loading-skeleton-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

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

/* ===== PROGRESS BAR ===== */
.loading-progress {
  width: 100%;
  height: 8px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.loading-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.loading-progress__bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: loading-progress-shine 2s infinite;
}

@keyframes loading-progress-shine {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.loading-progress__label {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

/* ===== OVERLAY ===== */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay--active {
  opacity: 1;
  pointer-events: all;
}

.loading-overlay--hiding {
  opacity: 0;
}

.loading-overlay__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: rgba(31, 41, 55, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.loading-overlay__message {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

/* ===== INLINE LOADING ===== */
.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.loading-inline__text {
  color: inherit;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .loading-overlay__content {
    padding: 16px;
    gap: 12px;
  }
  
  .loading-overlay__message {
    font-size: 12px;
  }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
  .loading-spinner__ring,
  .loading-skeleton,
  .loading-skeleton__line,
  .loading-progress__bar::after {
    animation: none !important;
  }
  
  .loading-overlay {
    transition: none !important;
  }
}

/* ===== FALLBACK ===== */
.loading-spinner--fallback {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  animation: loading-fallback-blink 1s infinite;
}

@keyframes loading-fallback-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
