/**
 * CSS para el loader de la página de productos
 * Utiliza los colores institucionales de Grupo Yoma
 */

/* Contenedor principal del loader */
.products-loader-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 9999;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Estado oculto del loader */
.products-loader-container.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Clase para body cuando el loader está activo */
body.loader-active {
  overflow: hidden;
}

/* Animación principal de loader con tubos de ensayo/moléculas */
.products-loader {
  position: relative;
  width: 180px;
  height: 180px;
}

/* Círculo base con color primario */
.products-loader:before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--primary-color);
  animation: spin 1.5s linear infinite;
}

/* Círculo intermedio con color de contraste */
.products-loader:after {
  content: '';
  position: absolute;
  width: 70%;
  height: 70%;
  top: 15%;
  left: 15%;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--contrast-color);
  animation: spin 2s linear infinite reverse;
}

/* Burbujas de moléculas */
.molecule {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--primary-color);
  opacity: 0.8;
  box-shadow: 0 0 10px rgba(255, 94, 16, 0.7);
}

.molecule-1 {
  top: 20px;
  left: 80px;
  animation: bubble 3s ease-in-out infinite;
}

.molecule-2 {
  top: 80px;
  left: 40px;
  width: 15px;
  height: 15px;
  background-color: var(--contrast-color);
  box-shadow: 0 0 10px rgba(24, 8, 56, 0.7);
  animation: bubble 2.5s ease-in-out 0.3s infinite;
}

.molecule-3 {
  top: 50px;
  left: 120px;
  width: 18px;
  height: 18px;
  background-color: var(--primary-color);
  animation: bubble 3.2s ease-in-out 0.5s infinite;
}

.molecule-4 {
  top: 100px;
  left: 130px;
  width: 12px;
  height: 12px;
  background-color: var(--contrast-color);
  box-shadow: 0 0 10px rgba(24, 8, 56, 0.7);
  animation: bubble 2.8s ease-in-out 0.7s infinite;
}

.molecule-5 {
  top: 120px;
  left: 60px;
  width: 16px;
  height: 16px;
  background-color: var(--primary-color);
  animation: bubble 3.5s ease-in-out 1s infinite;
}

/* Texto de carga */
.products-loader-text {
  margin-top: 20px;
  font-family: var(--primary-font);
  color: var(--secondary-color);
  font-size: 18px;
  font-weight: 600;
  position: relative;
  display: inline-block;
}

.products-loader-text::after {
  content: '...';
  position: absolute;
  width: 24px;
  text-align: left;
  animation: dots 1.5s infinite;
}

/* Animación de rotación */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Animación de burbujas */
@keyframes bubble {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* Animación de puntos suspensivos */
@keyframes dots {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
  100% { content: '.'; }
}

/* Adaptación para dispositivos móviles */
@media screen and (max-width: 768px) {
  .products-loader {
    width: 150px;
    height: 150px;
  }

  .products-loader-text {
    font-size: 16px;
  }

  .molecule {
    transform: scale(0.8);
  }
}
