/* Pantalla de carga — Clínica Roos */
body.rx-loading { overflow: hidden; }

.rx-loader {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: "Urbanist", sans-serif;
  color: #638969;
  pointer-events: all;
}

/* Cortinas que se abren al terminar */
.rx-loader .rx-curtain {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50.5%;
  background:
    radial-gradient(60% 90% at 50% 100%, rgba(159, 195, 230, .35), transparent 70%),
    linear-gradient(180deg, #f4faff 0%, #e4f1fb 100%);
  transition: transform .6s cubic-bezier(.77, 0, .18, 1);
}
.rx-loader .rx-curtain.top { top: 0; }
.rx-loader .rx-curtain.bottom {
  bottom: 0;
  background:
    radial-gradient(60% 90% at 50% 0%, rgba(159, 195, 230, .35), transparent 70%),
    linear-gradient(0deg, #f4faff 0%, #e4f1fb 100%);
}

/* Burbujas suaves flotando (hidratación / piel) */
.rx-loader .rx-bubbles { position: absolute; inset: 0; pointer-events: none; }
.rx-loader .rx-bubbles i {
  position: absolute;
  bottom: -60px;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .95), rgba(159, 195, 230, .35));
  border: 1px solid rgba(44, 71, 98, .12);
  animation: rxRise var(--d) linear infinite;
  animation-delay: var(--w);
}
@keyframes rxRise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-110vh) translateX(var(--dx)); opacity: 0; }
}

/* Contenido central */
.rx-loader .rx-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  transition: opacity .5s ease, transform .7s cubic-bezier(.77, 0, .18, 1);
}

.rx-loader .rx-ring {
  position: relative;
  width: 190px;
  height: 190px;
}
.rx-loader .rx-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.rx-loader .rx-ring .track { fill: none; stroke: rgba(44, 71, 98, .12); stroke-width: 3; }
.rx-loader .rx-ring .bar {
  fill: none;
  stroke: url(#rxGrad);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 553;
  stroke-dashoffset: 553;
  transition: stroke-dashoffset .25s linear;
}
.rx-loader .rx-ring .orbit {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px dashed rgba(44, 71, 98, .25);
  animation: rxSpin 14s linear infinite;
}
.rx-loader .rx-ring .orbit::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: #d2957e;
  box-shadow: 0 0 14px 4px rgba(159, 195, 230, .8);
}
@keyframes rxSpin { to { transform: rotate(360deg); } }

/* Latido del anillo (pulso) */
.rx-loader .rx-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(159, 195, 230, .7);
  animation: rxPulseRing 2s ease-out infinite;
}
@keyframes rxPulseRing {
  0% { transform: scale(1); opacity: .8; }
  100% { transform: scale(1.5); opacity: 0; }
}

.rx-loader .rx-logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rx-loader .rx-logo img {
  width: 150px;
  height: auto;
  animation: rxFloat 3s ease-in-out infinite;
}
@keyframes rxFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.04); }
}

/* Marca y porcentaje */
.rx-loader .rx-brand {
  text-align: center;
  line-height: 1.2;
}
.rx-loader .rx-brand strong {
  display: block;
  font-size: 22px;
  letter-spacing: .32em;
  text-transform: uppercase;
  font-weight: 700;
}
.rx-loader .rx-brand small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #3d7fb0;
}
.rx-loader .rx-percent {
  font-size: 46px;
  font-weight: 300;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.rx-loader .rx-percent span { font-size: 18px; opacity: .6; margin-left: 2px; }

/* Frase que cambia */
.rx-loader .rx-phrase {
  height: 22px;
  overflow: hidden;
  font-size: 14px;
  color: rgba(44, 71, 98, .75);
}
.rx-loader .rx-phrase span {
  display: block;
  text-align: center;
  animation: rxPhrase .5s ease both;
}
@keyframes rxPhrase {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Salida */
.rx-loader.rx-done .rx-center { opacity: 0; transform: scale(1.12); }
.rx-loader.rx-done .rx-curtain.top { transform: translateY(-101%); transition-delay: .05s; }
.rx-loader.rx-done .rx-curtain.bottom { transform: translateY(101%); transition-delay: .05s; }
.rx-loader.rx-done .rx-bubbles { opacity: 0; transition: opacity .4s ease; }
.rx-loader.rx-gone { display: none; }

@media (max-width: 575px) {
  .rx-loader .rx-ring { width: 160px; height: 160px; }
  .rx-loader .rx-logo img { width: 125px; }
  .rx-loader .rx-percent { font-size: 38px; }
  .rx-loader .rx-brand strong { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .rx-loader .rx-bubbles i, .rx-loader .rx-ring .orbit, .rx-loader .rx-ring::after, .rx-loader .rx-logo img { animation: none; }
}
