/* Datadash-style loading + success animations */

.pulse-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--color-primary-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.pulse-ring::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  opacity: 0.12;
  animation: ario-pulse 2.2s ease-in-out infinite;
}

.pulse-ring-spinner {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  border-top-color: var(--color-primary);
  animation: ario-spin 0.9s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.success-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-success) 12%, white);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.success-ring svg {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw 0.5s 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 30;
}

.confetti-piece {
  position: absolute;
  top: -24px;
  width: 10px;
  height: 18px;
  opacity: 0.95;
  animation: confetti-fall linear forwards;
  transform-origin: center;
}

@keyframes ario-pulse {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.08;
  }
  50% {
    transform: scale(1.04);
    opacity: 0.18;
  }
}

@keyframes ario-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes popIn {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift, 0px), 110vh, 0)
      rotate(var(--rotate, 360deg));
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-ring::before,
  .pulse-ring-spinner,
  .success-ring,
  .success-ring svg,
  .confetti-piece {
    animation: none !important;
  }
}
/* Loading animation — kept outside Tailwind (clip-path + nth-child can't be expressed as utilities) */

#loading {
  text-align: center;
  width: 150px;
  height: 150px;
  margin: 0 auto;
  position: relative;
  background: url("/images/gmail.svg") no-repeat center / contain;
}

.dazzling-animation {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}

.scanning-line {
  position: absolute;
  width: 100%;
  height: 4px;
  background: linear-gradient(
    to right,
    transparent 0%,
    #0066ff 20%,
    #00aaff 50%,
    #0066ff 80%,
    transparent 100%
  );
  animation: scan-vertical 3s ease-in-out infinite;
  top: 0;
  transform: translateY(-4px);
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #0088ff;
  animation: sparkle-star 1.5s infinite ease-out;
  box-shadow: 0 0 10px #0088ff;
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
}

.sparkle:nth-child(2) {
  top: 10%;
  left: 15%;
  animation-delay: 0s;
}
.sparkle:nth-child(3) {
  top: 25%;
  left: 65%;
  animation-delay: 0.2s;
}
.sparkle:nth-child(4) {
  top: 40%;
  left: 35%;
  animation-delay: 0.4s;
}
.sparkle:nth-child(5) {
  top: 55%;
  left: 80%;
  animation-delay: 0.6s;
}
.sparkle:nth-child(6) {
  top: 70%;
  left: 25%;
  animation-delay: 0.8s;
}
.sparkle:nth-child(7) {
  top: 85%;
  left: 70%;
  animation-delay: 1s;
}
.sparkle:nth-child(8) {
  top: 20%;
  left: 50%;
  animation-delay: 0.1s;
}
.sparkle:nth-child(9) {
  top: 35%;
  left: 85%;
  animation-delay: 0.3s;
}
.sparkle:nth-child(10) {
  top: 50%;
  left: 10%;
  animation-delay: 0.5s;
}
.sparkle:nth-child(11) {
  top: 65%;
  left: 90%;
  animation-delay: 0.7s;
}
.sparkle:nth-child(12) {
  top: 80%;
  left: 40%;
  animation-delay: 0.9s;
}

@keyframes scan-vertical {
  0%,
  100% {
    transform: translateY(40px);
    opacity: 0;
  }
  25%,
  75% {
    opacity: 1;
  }
  50% {
    transform: translateY(360px);
    opacity: 0;
  }
}

@keyframes sparkle-star {
  0%,
  100% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(180deg);
  }
}

/* Priming / recovery screens — mini replica of Google's consent screen with
   the two checkboxes auto-ticking on a loop (clip-path / nth-child timing can't
   be expressed as Tailwind utilities, so kept here). */
.prime-demo {
  position: relative;
  width: 368px;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--color-rule);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  text-align: left;
}
.pd-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-bottom: 1px solid #ededed;
  font-size: 12px;
  color: #5f6368;
  font-family: var(--font-body);
}
.pd-body {
  padding: 16px 18px 18px;
}
.pd-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f4694f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 11px;
}
.pd-title {
  font-size: 16px;
  color: #202124;
  line-height: 1.3;
  margin-bottom: 10px;
}
.pd-acct {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #3c4043;
  margin-bottom: 14px;
}
.pd-av {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #c1694f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex: none;
}
.pd-info {
  background: #e8f0fe;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 11.5px;
  color: #1f4493;
  line-height: 1.5;
}
.pd-info p {
  margin-bottom: 11px;
}
.pd-checkrow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.pd-select {
  font-size: 13px;
  color: #202124;
  margin-bottom: 10px;
}
.pd-scoperow {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #ebebeb;
  border-radius: 9px;
  padding: 11px 12px;
}
.pd-scopetext {
  flex: 1;
  font-size: 11.5px;
  color: #3c4043;
  line-height: 1.35;
}
.pd-gmail {
  width: 18px;
  height: 18px;
  flex: none;
}
.prime-box {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid #5f6368;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.prime-box .ck {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.4);
}
.prime-box::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 8px;
  border: 2px solid #1a73e8;
  opacity: 0;
  pointer-events: none;
}
.prime-box1 {
  animation: pbox1 4s ease-in-out infinite;
}
.prime-box1 .ck {
  animation: pck1 4s ease-in-out infinite;
}
.prime-box1::before {
  animation: pring1 4s ease-in-out infinite;
}
.prime-box2 {
  animation: pbox2 4s ease-in-out infinite;
}
.prime-box2 .ck {
  animation: pck2 4s ease-in-out infinite;
}
.prime-box2::before {
  animation: pring2 4s ease-in-out infinite;
}
@keyframes pbox1 {
  0%, 14% { background: #fff; border-color: #5f6368; }
  20%, 82% { background: #1a73e8; border-color: #1a73e8; }
  90%, 100% { background: #fff; border-color: #5f6368; }
}
@keyframes pck1 {
  0%, 16% { opacity: 0; transform: scale(0.4); }
  22%, 82% { opacity: 1; transform: scale(1); }
  89%, 100% { opacity: 0; transform: scale(0.4); }
}
@keyframes pbox2 {
  0%, 34% { background: #fff; border-color: #5f6368; }
  40%, 82% { background: #1a73e8; border-color: #1a73e8; }
  90%, 100% { background: #fff; border-color: #5f6368; }
}
@keyframes pck2 {
  0%, 36% { opacity: 0; transform: scale(0.4); }
  42%, 82% { opacity: 1; transform: scale(1); }
  89%, 100% { opacity: 0; transform: scale(0.4); }
}
@keyframes pring1 {
  0%, 8% { opacity: 0; transform: scale(0.7); }
  15% { opacity: 0.7; transform: scale(1); }
  27% { opacity: 0; transform: scale(1.3); }
  100% { opacity: 0; }
}
@keyframes pring2 {
  0%, 28% { opacity: 0; transform: scale(0.7); }
  35% { opacity: 0.7; transform: scale(1); }
  47% { opacity: 0; transform: scale(1.3); }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .prime-box1,
  .prime-box2,
  .prime-box1 .ck,
  .prime-box2 .ck,
  .prime-box1::before,
  .prime-box2::before {
    animation: none !important;
  }
  .prime-box1,
  .prime-box2 {
    background: #1a73e8;
    border-color: #1a73e8;
  }
  .prime-box1 .ck,
  .prime-box2 .ck {
    opacity: 1;
    transform: none;
  }
}
