.loader-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--primary-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
  overflow: hidden;
}

/* Fondo animado */
.loader-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.bg-line {
  position: absolute;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--secondary-color),
    var(--terciary-color),
    transparent
  );
  animation: bgLineScan 8s linear infinite;
  opacity: 0.2;
}

.bg-line:nth-child(1) {
  top: 25%;
  animation-delay: 0s;
}

.bg-line:nth-child(2) {
  top: 45%;
  animation-delay: 2s;
  animation-direction: reverse;
}

.bg-line:nth-child(3) {
  top: 65%;
  animation-delay: 4s;
}

.bg-line:nth-child(4) {
  top: 85%;
  animation-delay: 6s;
  animation-direction: reverse;
}

@keyframes bgLineScan {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
  position: relative;
}

/* Spinner moderno */
.loader-spinner {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 30px 0;
  perspective: 800px;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top: 3px solid var(--secondary-color);
  border-right: 3px solid var(--terciary-color);
  border-bottom: 3px solid var(--secondary-color);
  animation: spinnerRotate 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
  box-shadow: 0 0 20px rgba(255, 67, 101, 0.3);
}

.spinner-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--secondary-color), var(--terciary-color));
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(0, 217, 192, 0.5);
  animation: pulse 2s ease-in-out infinite alternate;
}

@keyframes spinnerRotate {
  0% {
    transform: rotateZ(0deg) rotateY(0deg);
  }
  50% {
    transform: rotateZ(180deg) rotateY(120deg);
  }
  100% {
    transform: rotateZ(360deg) rotateY(0deg);
  }
}

/* Iconos animados */
.loader-icons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 15px;
}

.loader-icon {
  font-size: 18px;
  animation: iconFloat 2s ease-in-out infinite;
  filter: drop-shadow(0 0 5px rgba(0, 217, 192, 0.5));
  opacity: 0;
}

.loader-icon:nth-child(1) {
  animation-delay: 0s;
}

.loader-icon:nth-child(2) {
  animation-delay: 0.5s;
}

.loader-icon:nth-child(3) {
  animation-delay: 1s;
}

.loader-icon:nth-child(4) {
  animation-delay: 1.5s;
}

@keyframes iconFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  50% {
    transform: translateY(-15px) scale(1.2);
    opacity: 1;
  }
}

.loader-logo {
  position: relative;
  width: 200px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
  0%, 100% {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(255, 67, 101, 0.5));
    transform: scale(1.05);
  }
}

.loader-text {
  margin-top: 20px;
  font-size: var(--body-font-size);
  color: var(--white-color);
  font-weight: 500;
  font-family: var(--primary-font-family);
  letter-spacing: 1px;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--white-color), var(--secondary-color), var(--terciary-color), var(--white-color));
  background-size: 300% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textGradient 4s linear infinite;
}

@keyframes textGradient {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.loader-text::after {
  content: '';
  display: inline-block;
  width: 0;
  animation: dots 1.5s infinite;
  position: relative;
  -webkit-text-fill-color: var(--white-color);
}

@keyframes dots {
  0% { width: 0; content: ''; }
  33% { width: 6px; content: '.'; }
  66% { width: 12px; content: '..'; }
  100% { width: 18px; content: '...'; }
}

.loader-progress {
  position: relative;
  width: 280px;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--default-border-radius);
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.loader-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--secondary-color), var(--terciary-color));
  border-radius: var(--default-border-radius);
  background-size: 200% 100%;
  animation: gradientMove 2s linear infinite, progress 4s ease-in-out infinite;
}

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

@keyframes progress {
  0% { width: 0%; }
  50% { width: 70%; }
  75% { width: 85%; }
  90% { width: 95%; }
  100% { width: 100%; }
}

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

@keyframes float {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes fadeInOut {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.loader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-active {
  opacity: 1;
  visibility: visible;
}

/* Añadir un efecto de gradiente para dar profundidad */
.loader-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(0, 217, 192, 0.05) 0%, rgba(27, 31, 35, 0) 70%);
  z-index: -1;
  animation: gradientPulse 8s ease infinite;
}

@keyframes gradientPulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}