/* Water loader for SSR payment flow */

html:has(body.water-loader-page),
body.water-loader-page {
  overflow: hidden;
  width: 100%;
  height: 100%;
}

body.water-loader-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;

  --wl-bg-1: #eff7ff;
  --wl-bg-2: #d8e8f7;
  --wl-ink: #17324c;
  --wl-muted: #597188;
  --wl-brand: #2577c8;
  --wl-brand-soft: #58afe8;
  --wl-water: #2583d8;
  --wl-water-soft: #b9e3ff;
  --wl-success: #22a06b;
  --wl-danger: #d94b4b;
  --wl-card: rgba(255, 255, 255, 0.86);
  --wl-border: rgba(41, 100, 153, 0.18);

  background:
    radial-gradient(circle at 20% 14%, rgba(97, 182, 241, 0.35), transparent 48%),
    radial-gradient(circle at 80% 84%, rgba(34, 160, 107, 0.14), transparent 40%),
    linear-gradient(180deg, var(--wl-bg-1) 0%, var(--wl-bg-2) 100%);
  color: var(--wl-ink);
  position: relative;
}

body.water-loader-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image: linear-gradient(transparent 96%, rgba(37, 119, 200, 0.15) 96%);
  background-size: 100% 12px;
}

.water-loader-container {
  width: min(500px, 92vw);
  position: relative;
  z-index: 2;
  animation: wl-fade-in 420ms ease-out both;
}

.wl-atmosphere {
  position: absolute;
  inset: -90px -40px auto;
  height: 300px;
  pointer-events: none;
  z-index: -1;
}

.wl-atmosphere__halo {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88, 175, 232, 0.35), rgba(88, 175, 232, 0) 72%);
  filter: blur(4px);
  animation: wl-float 5s ease-in-out infinite;
}

.wl-atmosphere__halo--alt {
  width: 220px;
  height: 220px;
  margin-left: auto;
  margin-top: -90px;
  opacity: 0.72;
  animation-delay: 0.8s;
}

.wl-card {
  pointer-events: auto;
  border: 1px solid var(--wl-border);
  border-radius: 24px;
  background: var(--wl-card);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 44px rgba(23, 50, 76, 0.14);
  padding: 24px 22px 22px;
}

.wl-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wl-brand);
}

.wl-title {
  margin: 8px 0 2px;
  font-size: clamp(22px, 3.8vw, 29px);
  line-height: 1.18;
}

.wl-subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--wl-muted);
}

.wl-visual {
  position: relative;
  height: 225px;
  margin: 14px 0 12px;
  display: grid;
  place-items: end center;
}

.wl-drop {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 34px;
  height: 34px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg, #7dcbff, var(--wl-water));
  box-shadow: 0 10px 18px rgba(37, 131, 216, 0.34), inset 0 -4px 10px rgba(15, 90, 160, 0.26);
  animation: wl-drop 2.6s ease-in-out infinite;
}

.wl-drop::before {
  content: "";
  position: absolute;
  left: 11px;
  top: -11px;
  width: 13px;
  height: 13px;
  transform: rotate(45deg);
  border-radius: 3px 10px 3px 10px;
  background: linear-gradient(180deg, #8fd5ff, #3b9cea);
}

.wl-drop::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 7px;
  width: 11px;
  height: 11px;
  transform: rotate(25deg);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.48);
}

.wl-doc {
  position: relative;
  width: 162px;
  height: 198px;
  border-radius: 18px;
  background: #fff;
  border: 4px solid #c5d9ea;
  box-shadow: 0 18px 40px rgba(17, 54, 92, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.wl-doc::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(110, 148, 182, 0.18);
  border-radius: 12px;
  pointer-events: none;
}

.wl-doc::after {
  content: "COMPROBANTE SSR";
  position: absolute;
  top: 14px;
  left: 20px;
  font-size: 9px;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: rgba(34, 88, 134, 0.5);
  z-index: 4;
}

.wl-doc__corner {
  position: absolute;
  right: 0;
  top: 0;
  width: 34px;
  height: 34px;
  background: #edf5fc;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  z-index: 4;
}

.wl-doc__lines {
  position: absolute;
  top: 34px;
  left: 20px;
  right: 20px;
  display: grid;
  gap: 10px;
  z-index: 4;
}

.wl-doc__lines span {
  height: 8px;
  border-radius: 999px;
  background: #e8f0f7;
}

.wl-doc__lines span:nth-child(1) {
  width: 84%;
}

.wl-doc__lines span:nth-child(2) {
  width: 92%;
}

.wl-doc__lines span:nth-child(3) {
  width: 72%;
}

.wl-doc__fill-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  overflow: hidden;
  z-index: 2;
}

.wl-doc-fill-rect {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  transform-origin: 50% 100%;
  transform: scaleY(0);
  background: linear-gradient(180deg, var(--wl-water-soft), var(--wl-water));
  transition: transform 180ms linear;
}

.wl-bubble {
  position: absolute;
  bottom: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  opacity: 0;
}

.wl-bubble--one {
  left: 62px;
  animation: wl-bubble 1.9s linear infinite;
}

.wl-bubble--two {
  left: 98px;
  width: 6px;
  height: 6px;
  animation: wl-bubble 2.4s linear 0.6s infinite;
}

.wl-doc__peso {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: rgba(20, 84, 138, 0.82);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(73, 137, 188, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  z-index: 4;
}

.wl-doc__stamp {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(14, 49, 79, 0.24);
  z-index: 5;
}

.wl-doc__stamp--loading {
  color: #fff;
  background: var(--wl-brand);
  animation: wl-spin 1.2s linear infinite;
}

.wl-doc__stamp--success {
  color: #fff;
  background: var(--wl-success);
}

.wl-doc__stamp--error {
  color: #fff;
  background: var(--wl-danger);
}

.wl-progress {
  margin-top: 4px;
}

.wl-progress__header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
}

.wl-progress__label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wl-muted);
  font-weight: 700;
}

.wl-progress__pct {
  font-size: 40px;
  font-weight: 800;
  color: var(--wl-brand);
  letter-spacing: -0.03em;
  line-height: 1;
}

.wl-progress__pct-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.wl-progress__track {
  height: 30px;
  border-radius: 999px;
  border: 3px solid #dbe7f3;
  background: #fff;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.wl-progress__fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(180deg, #5ab8f8, #2583d8);
  transition: width 0.2s linear;
  position: relative;
}

.wl-progress__fill::before,
.wl-progress__fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 12px 15px, rgba(255, 255, 255, 0.35) 0 8px, transparent 9px),
              radial-gradient(circle at 40px 10px, rgba(255, 255, 255, 0.2) 0 7px, transparent 8px),
              radial-gradient(circle at 70px 16px, rgba(255, 255, 255, 0.25) 0 8px, transparent 9px);
  background-size: 80px 100%;
  animation: wl-wave-move 1.5s linear infinite;
}

.wl-progress__fill::after {
  animation-duration: 2.2s;
  opacity: 0.42;
}

.wl-status {
  margin-top: 12px;
}

.wl-status__text {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--wl-muted);
  min-height: 1.2em;
  text-align: left;
}

.is-success .wl-drop {
  animation: none;
  opacity: 0;
}

.is-error .wl-drop {
  animation: none;
  opacity: 0.35;
}

.wl-card.wl-error {
  border-color: rgba(217, 75, 75, 0.45);
  box-shadow: 0 20px 44px rgba(120, 33, 33, 0.19);
}

.wl-generic-error {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 30;
  width: min(360px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 14px;
  border-left: 4px solid var(--wl-danger);
  background: rgba(35, 44, 53, 0.94);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  color: #fff;
}

.wl-generic-error__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--wl-danger);
  margin-bottom: 8px;
}

.wl-generic-error__title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}

.wl-generic-error__text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.35;
}

@media (max-width: 600px) {
  .water-loader-container {
    width: min(520px, 94vw);
  }

  .wl-card {
    padding: 20px 16px 18px;
    border-radius: 18px;
  }

  .wl-visual {
    height: 205px;
  }

  .wl-doc {
    width: 146px;
    height: 180px;
  }

  .wl-drop {
    top: 10px;
    width: 30px;
    height: 30px;
  }

  .wl-progress__pct {
    font-size: 34px;
  }

  .wl-progress__track {
    height: 26px;
  }
}

@media (max-height: 690px) {
  .wl-title {
    font-size: clamp(20px, 3.2vw, 24px);
  }

  .wl-visual {
    height: 186px;
    margin-top: 10px;
    margin-bottom: 8px;
  }

  .wl-doc {
    width: 132px;
    height: 162px;
  }
}

@keyframes wl-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wl-drop {
  0%,
  18% {
    transform: translate(-50%, -6px) scale(0.9);
    opacity: 0.96;
  }
  56% {
    transform: translate(-50%, 88px) scale(1);
    opacity: 0.95;
  }
  70% {
    transform: translate(-50%, 98px) scale(0.82, 1.14);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, 110px) scale(0.5, 0.45);
    opacity: 0;
  }
}

@keyframes wl-bubble {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  45% {
    opacity: 0.65;
  }
  100% {
    transform: translateY(-56px);
    opacity: 0;
  }
}

@keyframes wl-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes wl-wave-move {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-80px);
  }
}

@keyframes wl-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}