/* ==========================================================================
   ReadyToGo - Weekly Contest Launch Modal Styles
   Matches exact visual design: Glassmorphic blur overlay, sharp confetti burst,
   premium rounded card, glowing CTA, and sleek educational SaaS typography.
   ========================================================================== */

/* ── Overlay & Backdrop ─────────────────────────────────────────────────── */
.rtg-contest-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  overflow-x: hidden;
  perspective: 1000px;
}

.rtg-contest-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Glassmorphism Dark Blur Backdrop (Blurs the homepage behind it) */
.rtg-contest-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 32, 0.68);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.rtg-contest-overlay.is-active .rtg-contest-backdrop {
  opacity: 1;
}

/* ── Confetti Canvas (Real-time Paper Physics, behind card, in front of blur) ── */
.rtg-confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2; /* Behind modal stage (z:5), in front of backdrop blur (z:1) */
  display: block;
}

/* ── Stage & Confetti Layer (Sharper than backdrop, BEHIND modal card) ─── */
.rtg-contest-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 860px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
}

/* Confetti Container: Absolutely centered around stage, sharp & unblurred */
.rtg-confetti-field {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 2; /* In front of backdrop (z:1), behind card (z:5) */
}

/* Edge Confetti (Small subset overlapping card edges) */
.rtg-confetti-edge-field {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 6; /* Slightly above card */
}

/* Individual Confetti / Paper Pieces */
.rtg-confetti-piece {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--w, 14px);
  height: var(--h, 10px);
  background-color: var(--color, #0066ff);
  border-radius: var(--radius, 2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.1) rotate(0deg);
  will-change: transform, opacity;
}

/* Entrance explosion animation for confetti */
.rtg-contest-overlay.is-active .rtg-confetti-piece {
  animation: rtgConfettiExplode 0.65s cubic-bezier(0.18, 0.9, 0.32, 1.15) forwards var(--delay, 0.1s),
             rtgConfettiFloat 4s ease-in-out infinite calc(var(--delay, 0.1s) + 0.65s);
}

@keyframes rtgConfettiExplode {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2) rotate(0deg) skewX(0deg);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px)))
               scale(var(--scale, 1))
               rotate(var(--rot, 0deg))
               skewX(var(--skew, 0deg));
  }
}

@keyframes rtgConfettiFloat {
  0%, 100% {
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px)))
               scale(var(--scale, 1))
               rotate(var(--rot, 0deg))
               skewX(var(--skew, 0deg));
  }
  50% {
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px) - 5px))
               scale(var(--scale, 1))
               rotate(calc(var(--rot, 0deg) + 3deg))
               skewX(var(--skew, 0deg));
  }
}

/* ── Popup Card (Modal Container) ───────────────────────────────────────── */
.rtg-contest-card {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 840px;
  background: #ffffff;
  /* Premium subtle curved ambient gradient: soft pale blue curves at bottom/top */
  background-image: 
    radial-gradient(circle at 88% 95%, rgba(219, 234, 254, 0.65) 0%, rgba(239, 246, 255, 0.2) 42%, transparent 65%),
    radial-gradient(circle at 10% 8%, rgba(239, 246, 255, 0.8) 0%, rgba(248, 250, 252, 0.3) 45%, transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border-radius: 30px;
  padding: 46px 56px 42px;
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 
    0 0 55px rgba(59, 130, 246, 0.22),
    0 25px 65px -12px rgba(15, 23, 42, 0.38),
    0 1px 3px rgba(0, 0, 0, 0.05);
  text-align: center;
  transform: scale(0.92) translateY(24px);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.25, 0.64, 1),
              opacity 0.35s ease;
  overflow: visible;
}

.rtg-contest-overlay.is-active .rtg-contest-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Subtle corner aura decorations inside card */
.rtg-contest-card::before {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 260px;
  height: 200px;
  background: radial-gradient(circle at 100% 100%, rgba(191, 219, 254, 0.45) 0%, rgba(224, 242, 254, 0.1) 60%, transparent 80%);
  border-bottom-right-radius: 30px;
  pointer-events: none;
  z-index: 0;
}

.rtg-contest-card > * {
  position: relative;
  z-index: 1;
}

/* ── Close Button (Circular, Overlapping Top-Right Corner) ──────────────── */
.rtg-contest-close-btn {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  box-shadow: 
    0 4px 14px rgba(0, 0, 0, 0.1),
    0 0 14px rgba(59, 130, 246, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  cursor: pointer;
  z-index: 20;
  outline: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s ease,
              background-color 0.2s ease,
              color 0.2s ease;
}

.rtg-contest-close-btn:hover {
  transform: scale(1.1) rotate(90deg);
  background: #ffffff;
  color: #2563eb;
  border-color: #cbd5e1;
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.15),
    0 0 20px rgba(59, 130, 246, 0.32);
}

.rtg-contest-close-btn:active {
  transform: scale(0.96) rotate(90deg);
}

.rtg-contest-close-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}

/* ── Top Pill Label: "WEEKLY CONTEST" ──────────────────────────────────── */
.rtg-contest-pill-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.rtg-pill-flank {
  display: inline-block;
  width: 26px;
  height: 1.5px;
  background: #93c5fd;
  border-radius: 1px;
}

.rtg-contest-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 5px;
  text-transform: uppercase;
  padding: 7px 22px;
  border-radius: 9999px;
  box-shadow: inset 0 0 8px rgba(59, 130, 246, 0.08);
}

/* ── Main Heading: Two-Line Hierarchy ──────────────────────────────────── */
.rtg-contest-heading {
  font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
  margin: 0 0 14px;
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-align: center;
}

.rtg-heading-brand {
  display: block;
  font-size: 54px;
  font-weight: 800;
  color: #0f172a;
}

.rtg-heading-title {
  display: block;
  font-size: 54px;
  font-weight: 800;
  color: #0066ff;
  margin-top: 2px;
}

/* ── Supporting Subtitle ───────────────────────────────────────────────── */
.rtg-contest-subtext {
  font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 17px;
  font-weight: 600;
  color: #475569;
  line-height: 1.52;
  margin: 0 auto 28px;
  max-width: 620px;
  text-align: center;
}

/* ── Contest Information Horizontal Capsule ────────────────────────────── */
.rtg-contest-info-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  max-width: 520px;
  margin: 0 auto 30px;
  background: #ffffff;
  border: 1.5px solid #dbeafe;
  border-radius: 22px;
  padding: 14px 28px;
  box-shadow: 
    0 4px 14px -2px rgba(37, 99, 235, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.rtg-info-col {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.rtg-info-icon-bubble {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  flex-shrink: 0;
  box-shadow: inset 0 0 6px rgba(37, 99, 235, 0.12);
}

.rtg-info-icon-bubble svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2.1;
  fill: none;
}

.rtg-info-text-group {
  display: flex;
  flex-direction: column;
}

.rtg-info-label {
  font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.rtg-info-value {
  font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.rtg-info-divider {
  width: 1px;
  height: 38px;
  background: #e2e8f0;
  border-radius: 1px;
}

/* ── Primary CTA Button ────────────────────────────────────────────────── */
.rtg-contest-cta-box {
  margin-bottom: 16px;
}

.rtg-contest-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%);
  color: #ffffff;
  font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  padding: 16px 52px;
  min-width: 320px;
  border-radius: 9999px;
  box-shadow: 
    0 10px 25px -4px rgba(0, 102, 255, 0.46),
    0 4px 10px -2px rgba(0, 102, 255, 0.28);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.25s ease;
  position: relative;
  outline: none;
}

.rtg-contest-overlay.is-active .rtg-contest-cta-btn {
  animation: rtgCtaGlowPulse 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.6s 1;
}

@keyframes rtgCtaGlowPulse {
  0% {
    box-shadow: 0 10px 25px -4px rgba(0, 102, 255, 0.46), 0 4px 10px -2px rgba(0, 102, 255, 0.28);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 35px 8px rgba(0, 102, 255, 0.68), 0 14px 28px rgba(0, 102, 255, 0.42);
    transform: scale(1.025);
  }
  100% {
    box-shadow: 0 10px 25px -4px rgba(0, 102, 255, 0.46), 0 4px 10px -2px rgba(0, 102, 255, 0.28);
    transform: scale(1);
  }
}

.rtg-contest-cta-btn:hover {
  color: #ffffff;
  transform: translateY(-3px);
  box-shadow: 
    0 16px 34px -4px rgba(0, 102, 255, 0.62),
    0 6px 14px -2px rgba(0, 102, 255, 0.35);
  background: linear-gradient(135deg, #0d70ff 0%, #004ecc 100%);
}

.rtg-contest-cta-btn:hover .rtg-cta-arrow {
  transform: translateX(6px);
}

.rtg-contest-cta-btn:active {
  transform: translateY(-1px);
}

.rtg-cta-arrow {
  width: 19px;
  height: 19px;
  stroke: #ffffff;
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Bottom Message: "Don't miss this week's challenge!" ───────────────── */
.rtg-contest-bottom-note {
  margin-top: 8px;
}

.rtg-bottom-note-text {
  font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  margin: 0;
  letter-spacing: -0.01em;
}

.rtg-bottom-note-dash {
  display: block;
  width: 40px;
  height: 2px;
  background: #3b82f6;
  border-radius: 2px;
  margin: 7px auto 0;
  opacity: 0.85;
}

/* ── Responsive Adaptations ────────────────────────────────────────────── */

/* Tablet (<= 920px) */
@media (max-width: 920px) {
  .rtg-contest-card {
    max-width: 700px;
    padding: 38px 40px 34px;
  }
  .rtg-heading-brand,
  .rtg-heading-title {
    font-size: 44px;
  }
  .rtg-contest-subtext {
    font-size: 15px;
    margin-bottom: 22px;
  }
  .rtg-contest-info-container {
    max-width: 480px;
    padding: 12px 22px;
    margin-bottom: 24px;
  }
  .rtg-info-value {
    font-size: 16px;
  }
}

/* Mobile (<= 640px) */
@media (max-width: 640px) {
  .rtg-contest-overlay {
    padding: 16px 12px;
    align-items: center;
  }
  .rtg-contest-card {
    max-width: 94vw;
    padding: 34px 20px 28px;
    border-radius: 24px;
  }
  .rtg-contest-close-btn {
    top: -14px;
    right: -10px;
    width: 38px;
    height: 38px;
  }
  .rtg-contest-close-btn svg {
    width: 14px;
    height: 14px;
  }
  .rtg-contest-pill-wrapper {
    gap: 8px;
    margin-bottom: 14px;
  }
  .rtg-pill-flank {
    width: 16px;
  }
  .rtg-contest-pill {
    font-size: 11px;
    letter-spacing: 3px;
    padding: 6px 16px;
  }
  .rtg-heading-brand,
  .rtg-heading-title {
    font-size: 32px;
  }
  .rtg-contest-subtext {
    font-size: 14px;
    line-height: 1.45;
    margin-bottom: 20px;
  }
  .rtg-contest-info-container {
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 22px;
    border-radius: 18px;
  }
  .rtg-info-col {
    width: 100%;
    justify-content: flex-start;
  }
  .rtg-info-divider {
    width: 100%;
    height: 1px;
  }
  .rtg-info-icon-bubble {
    width: 38px;
    height: 38px;
  }
  .rtg-info-icon-bubble svg {
    width: 18px;
    height: 18px;
  }
  .rtg-info-value {
    font-size: 16px;
  }
  .rtg-contest-cta-btn {
    width: 100%;
    min-width: 0;
    padding: 14px 24px;
    font-size: 16px;
  }
  /* Hide excessive confetti on very small mobile screens to keep view clean */
  .rtg-confetti-field .rtg-confetti-piece:nth-child(n+26) {
    display: none;
  }
}
