/* =========================================================
   RIFA MASTER - EFECTOS DE BARRA (MEJORADOS)
   Objetivo: animación continua, premium, estable y fluida
   ========================================================= */

/* ---------- BASE GENERAL PARA LA BARRA ---------- */
#p_bar_fill,
.rm-bar-fill {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    var(--rm-fill-1, #e63946),
    var(--rm-fill-2, #ff8a80)
  );

  /* Rendimiento / suavidad */
  transform: translateZ(0);
  will-change: background-position, filter;
  backface-visibility: hidden;
}

#p_bar_fill span,
.rm-bar-fill span {
  position: relative;
  z-index: 3;
}

/* Capa base animada */
#p_bar_fill::before,
.rm-bar-fill::before {
  content: "";
  position: absolute;
  inset: -2px;               /* evita cortes por bordes/redondeo */
  pointer-events: none;
  z-index: 1;
  transform: translateZ(0);
  will-change: transform, opacity, background-position;
}

/* Segunda capa: brillo premium (si el estilo la usa) */
#p_bar_fill::after,
.rm-bar-fill::after {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transform: translateZ(0);
  will-change: transform, opacity;
}

/* ---------- KEYFRAMES (LOOPS PERFECTOS) ---------- */

/* Rayas diagonales: loop perfecto al usar bg-size = 48px 48px */
@keyframes rmStripesSlide {
  from { background-position: 0 0; }
  to   { background-position: -48px 0; }
}

/* Shine: recorrido continuo, sin “fade raro” */
@keyframes rmShineMove {
  0%   { transform: translateX(-140%); opacity: 0; }
  12%  { opacity: 0.55; }
  50%  { opacity: 0.9; }
  88%  { opacity: 0.55; }
  100% { transform: translateX(140%); opacity: 0; }
}

/* Pulso más sutil (menos “flash”) */
@keyframes rmPulseSoft {
  0%   { filter: brightness(1) saturate(1); }
  50%  { filter: brightness(1.08) saturate(1.06); }
  100% { filter: brightness(1) saturate(1); }
}

/* Onda: loop perfecto con bg-size 120px */
@keyframes rmWave {
  from { background-position: 0 0; }
  to   { background-position: -120px 0; }
}

/* Bloques/pixel: loop perfecto con bg-size 40px */
@keyframes rmBlocksMove {
  from { background-position: 0 0; }
  to   { background-position: -40px 0; }
}

/* Glow externo: más fino */
@keyframes rmOuterGlow {
  0%   { box-shadow: 0 0 0 rgba(255,255,255,0.08); }
  50%  { box-shadow: 0 0 18px rgba(255,255,255,0.22); }
  100% { box-shadow: 0 0 0 rgba(255,255,255,0.08); }
}

/* Parallax doble: loops perfectos con 64px */
@keyframes rmParallaxA {
  from { background-position: 0 0; }
  to   { background-position: -64px 0; }
}
@keyframes rmParallaxB {
  from { background-position: -64px 0; }
  to   { background-position: 0 0; }
}

/* =========================================================
   STYLE 1 - CLÁSICO RAYAS DIAGONALES (más fino)
   ========================================================= */
#p_bar_fill.style-1,
.rm-bar-fill.style-1 {
  background: linear-gradient(
    90deg,
    var(--rm-fill-1, #e63946),
    var(--rm-fill-2, #ff8a80)
  );
}

#p_bar_fill.style-1::before,
.rm-bar-fill.style-1::before {
  background-image: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.26) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.26) 50%,
    rgba(255, 255, 255, 0.26) 75%,
    transparent 75%,
    transparent
  );
  background-size: 48px 48px;
  animation: rmStripesSlide 0.95s linear infinite;
  opacity: 0.95;
}

/* =========================================================
   STYLE 2 - DEGRADADO + SHINE PREMIUM (suave)
   ========================================================= */
#p_bar_fill.style-2,
.rm-bar-fill.style-2 {
  background: linear-gradient(
    90deg,
    var(--rm-fill-1, #FF6B6B),
    var(--rm-fill-2, #FFD93D)
  );
  animation: rmPulseSoft 2.2s ease-in-out infinite;
}

#p_bar_fill.style-2::before,
.rm-bar-fill.style-2::before {
  background: radial-gradient(
    circle at 30% 50%,
    rgba(255,255,255,0.14),
    transparent 55%
  );
  opacity: 0.85;
}

#p_bar_fill.style-2::after,
.rm-bar-fill.style-2::after {
  opacity: 1;
  width: 70%;
  left: -20%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.85) 45%,
    rgba(255, 255, 255, 0.85) 55%,
    transparent 100%
  );
  filter: blur(1px);
  animation: rmShineMove 2.6s linear infinite;
}

/* =========================================================
   STYLE 3 - RAYAS MULTICOLOR (más elegante)
   ========================================================= */
#p_bar_fill.style-3,
.rm-bar-fill.style-3 {
  background: linear-gradient(
    90deg,
    var(--rm-fill-1, #00C6FF),
    var(--rm-fill-2, #0072FF)
  );
}

#p_bar_fill.style-3::before,
.rm-bar-fill.style-3::before {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.06) 0px,
    rgba(255, 255, 255, 0.06) 8px,
    rgba(0, 0, 0, 0.12) 8px,
    rgba(0, 0, 0, 0.12) 16px
  );
  background-size: 48px 48px;
  animation: rmStripesSlide 0.85s linear infinite;
  opacity: 0.95;
}

/* =========================================================
   STYLE 4 - ONDA FLUIDA (más real)
   ========================================================= */
#p_bar_fill.style-4,
.rm-bar-fill.style-4 {
  background-image:
    linear-gradient(
      90deg,
      rgba(255,255,255,0.10) 20%,
      rgba(255,255,255,0.24) 50%,
      rgba(255,255,255,0.10) 80%
    ),
    linear-gradient(
      90deg,
      var(--rm-fill-1, #00b09b),
      var(--rm-fill-2, #96c93d)
    );
  background-size: 120px 100%, 100% 100%;
  animation: rmWave 1.35s linear infinite;
}

/* =========================================================
   STYLE 5 - GLOW NEÓN (menos agresivo)
   ========================================================= */
#p_bar_fill.style-5,
.rm-bar-fill.style-5 {
  background: linear-gradient(
    90deg,
    var(--rm-fill-1, #34D399),
    var(--rm-fill-2, #22C55E)
  );
  animation: rmOuterGlow 1.8s ease-in-out infinite, rmPulseSoft 2.8s ease-in-out infinite;
}

#p_bar_fill.style-5::before,
.rm-bar-fill.style-5::before {
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.18),
    transparent 60%
  );
  background-size: 120px 100%;
  animation: rmWave 1.6s linear infinite;
  opacity: 0.9;
}

/* =========================================================
   STYLE 6 - BLOQUES / PIXEL (loop perfecto)
   ========================================================= */
#p_bar_fill.style-6,
.rm-bar-fill.style-6 {
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.13) 0,
      rgba(255, 255, 255, 0.13) 14px,
      transparent 14px,
      transparent 28px
    ),
    linear-gradient(
      90deg,
      var(--rm-fill-1, #6366F1),
      var(--rm-fill-2, #A855F7)
    );
  background-size: 40px 100%, 100% 100%;
  animation: rmBlocksMove 0.95s linear infinite;
}

/* =========================================================
   STYLE 7 - DOBLE CAPA PARALLAX (más sutil)
   ========================================================= */
#p_bar_fill.style-7,
.rm-bar-fill.style-7 {
  background: linear-gradient(
    90deg,
    var(--rm-fill-1, #EF4444),
    var(--rm-fill-2, #F97316)
  );
}

#p_bar_fill.style-7::before,
.rm-bar-fill.style-7::before {
  background-image:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.12) 25%,
      transparent 25%,
      transparent 50%,
      rgba(255, 255, 255, 0.12) 50%,
      rgba(255, 255, 255, 0.12) 75%,
      transparent 75%,
      transparent
    ),
    linear-gradient(
      -120deg,
      rgba(0, 0, 0, 0.12) 25%,
      transparent 25%,
      transparent 50%,
      rgba(0, 0, 0, 0.12) 50%,
      rgba(0,  0, 0, 0.12) 75%,
      transparent 75%,
      transparent
    );
  background-size: 64px 64px, 64px 64px;
  animation: rmParallaxA 1.35s linear infinite, rmParallaxB 1.55s linear infinite;
  opacity: 0.95;
}

/* =========================================================
   STYLE 8 - GLASS (brillo continuo, elegante)
   ========================================================= */
#p_bar_fill.style-8,
.rm-bar-fill.style-8 {
  background: linear-gradient(
    90deg,
    var(--rm-fill-1, #0EA5E9),
    var(--rm-fill-2, #22D3EE)
  );
  backdrop-filter: blur(2px);
}

#p_bar_fill.style-8::after,
.rm-bar-fill.style-8::after {
  opacity: 1;
  width: 70%;
  left: -20%;
  background: radial-gradient(
    circle at 30% 50%,
    rgba(255,255,255,0.85) 0,
    rgba(255,255,255,0.10) 45%,
    transparent 70%
  );
  filter: blur(1.2px);
  animation: rmShineMove 3.0s linear infinite;
}

/* =========================================================
   STYLE 9 - LAVA (fluido premium)
   ========================================================= */
#p_bar_fill.style-9,
.rm-bar-fill.style-9 {
  background-image:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.14),
      transparent 60%
    ),
    linear-gradient(
      90deg,
      var(--rm-fill-1, #F97316),
      var(--rm-fill-2, #FACC15)
    );
  background-size: 120px 100%, 100% 100%;
  animation: rmWave 1.1s linear infinite, rmPulseSoft 2.6s ease-in-out infinite;
}

#p_bar_fill.style-9::before,
.rm-bar-fill.style-9::before {
  background-image: radial-gradient(
    circle at 30% 50%,
    rgba(255, 255, 255, 0.18),
    transparent 60%
  );
  opacity: 0.9;
}

/* =========================================================
   STYLE 10 - MONOCOLOR ELEGANTE (shine lento premium)
   ========================================================= */
#p_bar_fill.style-10,
.rm-bar-fill.style-10 {
  background: linear-gradient(
    90deg,
    var(--rm-fill-1, #1F2937),
    var(--rm-fill-2, #4B5563)
  );
  animation: rmPulseSoft 3.0s ease-in-out infinite;
}

#p_bar_fill.style-10::after,
.rm-bar-fill.style-10::after {
  opacity: 1;
  width: 78%;
  left: -25%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 100%
  );
  filter: blur(1.2px);
  animation: rmShineMove 3.6s linear infinite;
}

/* =========================================================
   Accesibilidad: reducir movimiento si el usuario lo pide
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  #p_bar_fill,
  .rm-bar-fill,
  #p_bar_fill::before,
  .rm-bar-fill::before,
  #p_bar_fill::after,
  .rm-bar-fill::after {
    animation: none !important;
  }
}
