/* ============================================================================
   Congratulation Page
   body.page-congratulation
   ============================================================================ */

/* ── Layout ──────────────────────────────────────────────────────────────── */
body.page-congratulation {
  background: linear-gradient(145deg, #f2f4ff 0%, #eef0ff 50%, #f6f3ff 100%);
  min-height: 100vh;
}

body.ipoji-dark-mode.page-congratulation {
  background: var(--dm-bg)!important;
}
.congrats-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  padding: 2rem 1rem 3rem;
}

.congrats-main--app {
  /* min-height: 100vh; */
  /* padding-top: 2.5rem; */
  /* padding: 0!important; */
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.congrats-card {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 12px 48px rgba(96, 85, 205, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 0 2rem 2rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  position: relative;
  overflow: visible;
  animation: congrats-card-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Soft pastel header band behind the illustration */
.congrats-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 230px;
  border-radius: 24px 24px 60% 60% / 24px 24px 40px 40px;
  background: linear-gradient(160deg, #f0eeff 0%, #e8f4ff 100%);
  z-index: 0;
  pointer-events: none;
}

/* Ensure illustration and text sit above the header band */
.done,
.congrats-stars,
.congrats-title,
.congrats-subtitle {
  position: relative;
  z-index: 2;
}

/* Top padding for illustration area is handled via margin-top in the .done rule below */

@keyframes congrats-card-in {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ── Confetti (JS-generated) ─────────────────────────────────────────────── */
/* Full-screen fixed overlay — pointer-events off so it doesn't block clicks.
   position + dimensions use !important so the Confettiful JS (which always
   sets element.style.position = 'relative' via an inline style) cannot
   collapse the overlay. offsetWidth still returns 100vw correctly. */
.js-container {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw;
  height: 100vh;
  z-index: 99;
  pointer-events: none;
  overflow: hidden;
}

.confetti-container {
  perspective: 700px;
  position: absolute;
  overflow: hidden;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.confetti {
  position: absolute;
  z-index: 1;
  top: -10px;
}

/* Flattened from SCSS &--animation-* nesting */
@keyframes confetti-slow {
  0%   { transform: translate3d(0, 0, 0) rotateX(0) rotateY(0); }
  100% { transform: translate3d(25px, 105vh, 0) rotateX(360deg) rotateY(180deg); }
}

@keyframes confetti-medium {
  0%   { transform: translate3d(0, 0, 0) rotateX(0) rotateY(0); }
  100% { transform: translate3d(100px, 105vh, 0) rotateX(100deg) rotateY(360deg); }
}

@keyframes confetti-fast {
  0%   { transform: translate3d(0, 0, 0) rotateX(0) rotateY(0); }
  100% { transform: translate3d(-50px, 105vh, 0) rotateX(10deg) rotateY(250deg); }
}

.confetti--animation-slow   { animation: confetti-slow   2.25s linear 1 forwards; }
.confetti--animation-medium { animation: confetti-medium 1.75s linear 1 forwards; }
.confetti--animation-fast   { animation: confetti-fast   1.25s linear 1 forwards; }

/* ── Star burst ──────────────────────────────────────────────────────────── */
/* Overlay sits over the card; overflow:visible lets stars fly outside it */
.congrats-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}

/* Individual star — starts hidden at center, JS animates it outward */
.blob {
  height: 50px;
  width: 50px;
  color: #ffcc00;
  position: absolute;
  /* Center is injected per burst from JS using tick position */
  top: var(--star-origin-y, 50%);
  left: var(--star-origin-x, 50%);
  margin-top: -25px;
  margin-left: -25px;
  z-index: 1;
  font-size: 22px;
  display: none;
  pointer-events: none;
  will-change: transform, opacity;
}

/* ── Done illustration (document stack + animated SVG tick) ─────────────── */
.done {
  width: 300px;
  height: 180px;
  position: relative;
  z-index: 2;
  margin: 2rem auto 1.25rem;
  animation: illus-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

@keyframes illus-in {
  from { opacity: 0; transform: translateY(14px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.done-illustration {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ── Center document card ── */
.done .center-block {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 120px;
  z-index: 10;
  animation: card-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s both;
}

@keyframes card-pop {
  from { opacity: 0; transform: translateX(-50%) scale(0.6); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

.done .main-block {
  position: relative;
  width: 80px;
  height: 120px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 0 3px #585588, 0 0 0 6px #71cbf5, 0 0 0 9px #585588;
}

.done .rose-block {
  position: absolute;
  top: -13px;
  left: 14px;
  width: 44px;
  height: 11px;
  background: #ff8d93;
  border-radius: 5px;
  border: 3px solid #585588;
}

.done .light-rose-block {
  position: absolute;
  top: -5px;
  left: 22px;
  width: 28px;
  height: 4px;
  background: #ffc5cb;
  border-radius: 3px;
}

.done .r {
  position: absolute;
  top: 0;
  left: 17px;
  width: 36px;
  height: 10px;
  border: 3px solid #585588;
  border-radius: 0 0 8px 8px;
  border-top: none;
  z-index: 2;
}

/* ── SVG tick (replaces green-circle) ── */
.done-tick {
  position: absolute;
  top: 28px;
  left: 11px;
  width: 56px;
  height: 56px;
}

.done-tick svg {
  width: 100%;
  height: 100%;
  display: block;
}

.done-tick .path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}

.done-tick.drawn .circ.path {
  animation: svg-draw 0.7s ease-in-out forwards;
}

.done-tick.drawn .tick.path {
  animation: svg-draw 0.5s ease-in-out 0.55s forwards;
}

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

/* ── Side document cards ── */
.done .left-block {
  position: absolute;
  width: 72px;
  height: 100px;
  top: 30%;
  left: 14%;
  transform: rotate(-19deg);
  z-index: 0;
  animation: side-card-in-left 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) 0.4s both;
}

@keyframes side-card-in-left {
  from { opacity: 0; transform: rotate(-19deg) translateX(-20px); }
  to   { opacity: 1; transform: rotate(-19deg) translateX(0); }
}

.done .right-block {
  position: absolute;
  width: 72px;
  height: 100px;
  top: 30%;
  right: 14%;
  transform: rotate(19deg);
  z-index: 0;
  animation: side-card-in-right 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) 0.4s both;
}

@keyframes side-card-in-right {
  from { opacity: 0; transform: rotate(19deg) translateX(20px); }
  to   { opacity: 1; transform: rotate(19deg) translateX(0); }
}

.done .left-main-block {
  position: relative;
  width: 72px;
  height: 100px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 0 3px #585588, 0 0 0 6px #71cbf5, 0 0 0 9px #585588;
  overflow: hidden;
}

.done .grey-line {
  position: relative;
  top: 22px;
  left: 8px;
  width: 75%;
  height: 6px;
  background: #e8e8f0;
  border-radius: 3px;
  margin-top: 8px;
}

/* ── Decorative circles ── */
.done .done-circ {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: circ-in 0.4s ease-out forwards;
}

@keyframes circ-in {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: scale(1); }
}

.done .yellow { background: #ffd234; }
.done .blue   { background: #71cbf5; }
.done .rose   { background: #ff8d93; }

.done .circle10 { width: 9px;  height: 9px;  animation-delay: 0.35s; }
.done .circle5  { width: 6px;  height: 6px;  animation-delay: 0.45s; }
.done .circle3  { width: 4px;  height: 4px;  animation-delay: 0.55s; }

.done .c1  { top: 14%; left: 18%; }
.done .c2  { top: 22%; left: 62%; }
.done .c3  { top: 12%; left: 44%; }
.done .c4  { top: 16%; left: 80%; }
.done .c5  { top: 24%; left: 54%; }
.done .c6  { top: 6%;  left: 36%; }
.done .c7  { top: 28%; left: 84%; }
.done .c8  { top: 10%; left: 8%;  }
.done .c9  { top: 32%; left: 20%; }
.done .c10 { top: 44%; left: 25%; }
.done .c11 { top: 20%; left: 66%; }
.done .c12 { top: 36%; left: 42%; }
.done .c13 { top: 18%; left: 72%; }
.done .c14 { top: 48%; left: 18%; }
.done .c15 { top: 38%; left: 88%; }
.done .c16 { top: 8%;  left: 74%; }
.done .c17 { top: 8%;  left: 30%; }
.done .c18 { top: 46%; left: 10%; }
.done .c19 { top: 6%;  left: 48%; }
.done .c20 { top: 2%;  left: 22%; }
.done .c21 { top: 12%; left: 90%; }
.done .c22 { top: 2%;  left: 14%; }
.done .c23 { top: 40%; left: 82%; }
.done .c24 { top: 28%; left: 78%; }
.done .c25 { top: 4%;  left: 58%; }

/* ── Typography ──────────────────────────────────────────────────────────── */
.congrats-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #000d50;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.congrats-subtitle {
  font-size: 0.9375rem;
  color: #4c5a8a;
  margin-bottom: 1.75rem;
  line-height: 1.55;
}

/* ── Summary table ───────────────────────────────────────────────────────── */
.congrats-summary {
  background: linear-gradient(135deg, rgba(96, 85, 205, 0.04) 0%, rgba(96, 85, 205, 0.02) 100%);
  border: 1px solid rgba(96, 85, 205, 0.12);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.75rem;
  text-align: left;
  position: relative;
  z-index: 2;
}

.congrats-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(96, 85, 205, 0.07);
}

.congrats-summary-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.congrats-summary-row:first-child {
  padding-top: 0;
}

.congrats-summary-label {
  font-size: 0.8125rem;
  color: #6c757d;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.congrats-summary-label i {
  color: #6055cd;
  font-size: 0.75rem;
}

.congrats-summary-value {
  font-size: 0.875rem;
  color: #000d50;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

.congrats-summary-value--bold {
  font-weight: 700;
  color: #000d50;
}

.congrats-summary-value--amount {
  font-weight: 700;
  color: #6055cd;
  font-size: 0.9375rem;
}

/* ── What's next steps ───────────────────────────────────────────────────── */
.congrats-steps {
  text-align: left;
  margin-bottom: 1.75rem;
  position: relative;
  z-index: 2;
}

.congrats-steps-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6055cd;
  margin-bottom: 0.875rem;
}

.congrats-steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.congrats-step {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.congrats-step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6055cd, #8427d7);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.congrats-step > div {
  flex: 1;
}

.congrats-step strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: #000d50;
  margin-bottom: 2px;
}

.congrats-step p {
  margin: 0;
  font-size: 0.8125rem;
  color: #6c757d;
  line-height: 1.5;
}

/* ── Action buttons ──────────────────────────────────────────────────────── */
.congrats-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 2;
}

.congrats-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.congrats-btn--primary {
  background: linear-gradient(135deg, #6055cd, #8427d7);
  color: #fff;
  box-shadow: 0 6px 20px rgba(96, 85, 205, 0.35);
}

.congrats-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(96, 85, 205, 0.45);
  color: #fff;
}

.congrats-btn--secondary {
  background: rgba(96, 85, 205, 0.08);
  color: #6055cd;
  border: 1.5px solid rgba(96, 85, 205, 0.2);
}

.congrats-btn--secondary:hover {
  background: rgba(96, 85, 205, 0.14);
  color: #6055cd;
  border-color: rgba(96, 85, 205, 0.35);
  transform: translateY(-1px);
}

.congrats-btn--ghost {
  background: transparent;
  color: #6c757d;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
}

.congrats-btn--ghost:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #495057;
  border-color: rgba(0, 0, 0, 0.2);
}

/* ── Branding ────────────────────────────────────────────────────────────── */
.congrats-brand {
  font-size: 0.75rem;
  color: #adb5bd;
  margin: 0;
  position: relative;
  z-index: 2;
}

.congrats-brand-link {
  color: #6055cd;
  text-decoration: none;
  font-weight: 600;
}

.congrats-brand-link:hover {
  text-decoration: underline;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .congrats-card {
    padding: 2rem 1.25rem 1.5rem;
    border-radius: 18px;
  }

  .congrats-title {
    font-size: 1.5rem;
  }

  .done {
    width: 260px;
    height: 155px;
  }

  .congrats-summary-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .congrats-summary-value {
    text-align: left;
  }
}

/* ============================================================================
   Dark Mode
   ============================================================================ */
body.ipoji-dark-mode.page-congratulation {
  --dm-bg:             #0D0E11;
  --dm-card:           #181A1F;
  --dm-surface:        #121316;
  --dm-chip:           #23262D;
  --dm-text-primary:   #E7E1E8;
  --dm-text-secondary: #BFC2CC;
  --dm-text-muted:     #8B9099;
  --dm-primary:        #B7AEFF;
  --dm-primary-btn:    #6055CD;
  --dm-border:         rgba(255, 255, 255, 0.12);
  background: linear-gradient(145deg, var(--dm-bg) 0%, #10121a 50%, #0e0f14 100%);
}

body.ipoji-dark-mode.page-congratulation .congrats-card {
  background: var(--dm-card);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.ipoji-dark-mode.page-congratulation .congrats-card::before {
  background: linear-gradient(160deg, #1a1c26 0%, #181e2a 100%);
}

body.ipoji-dark-mode.page-congratulation .congrats-title {
  color: var(--dm-text-primary);
}

body.ipoji-dark-mode.page-congratulation .congrats-subtitle {
  color: var(--dm-text-secondary);
}

body.ipoji-dark-mode.page-congratulation .done .main-block,
body.ipoji-dark-mode.page-congratulation .done .left-main-block {
  background: #23262d;
  box-shadow: 0 0 0 3px #585588, 0 0 0 6px #4a8fa8, 0 0 0 9px #585588;
}

body.ipoji-dark-mode.page-congratulation .done .grey-line {
  background: #2e3240;
}

body.ipoji-dark-mode.page-congratulation .done-tick .circ.path {
  fill: #0cdcc7;
  stroke: #07a796;
}

body.ipoji-dark-mode.page-congratulation .congrats-summary {
  background: rgba(183, 174, 255, 0.06);
  border-color: var(--dm-border);
}

body.ipoji-dark-mode.page-congratulation .congrats-summary-row {
  border-bottom-color: var(--dm-border);
}

body.ipoji-dark-mode.page-congratulation .congrats-summary-label {
  color: var(--dm-text-muted);
}

body.ipoji-dark-mode.page-congratulation .congrats-summary-label i {
  color: var(--dm-primary);
}

body.ipoji-dark-mode.page-congratulation .congrats-summary-value {
  color: var(--dm-text-primary);
}

body.ipoji-dark-mode.page-congratulation .congrats-summary-value--bold {
  color: var(--dm-text-primary);
}

body.ipoji-dark-mode.page-congratulation .congrats-summary-value--amount {
  color: var(--dm-primary);
}

body.ipoji-dark-mode.page-congratulation .congrats-steps-title {
  color: var(--dm-primary);
}

body.ipoji-dark-mode.page-congratulation .congrats-step-num {
  background: linear-gradient(135deg, var(--dm-primary-btn), #8427d7);
}

body.ipoji-dark-mode.page-congratulation .congrats-step strong {
  color: var(--dm-text-primary);
}

body.ipoji-dark-mode.page-congratulation .congrats-step p {
  color: var(--dm-text-muted);
}

body.ipoji-dark-mode.page-congratulation .congrats-btn--primary {
  background: linear-gradient(135deg, var(--dm-primary-btn), #8427d7);
}

body.ipoji-dark-mode.page-congratulation .congrats-btn--secondary {
  background: rgba(183, 174, 255, 0.1);
  color: var(--dm-primary);
  border-color: rgba(183, 174, 255, 0.2);
}

body.ipoji-dark-mode.page-congratulation .congrats-btn--secondary:hover {
  background: rgba(183, 174, 255, 0.16);
  color: var(--dm-primary);
  border-color: rgba(183, 174, 255, 0.35);
}

body.ipoji-dark-mode.page-congratulation .congrats-btn--ghost {
  color: var(--dm-text-muted);
  border-color: var(--dm-border);
}

body.ipoji-dark-mode.page-congratulation .congrats-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--dm-text-secondary);
}

body.ipoji-dark-mode.page-congratulation .congrats-brand {
  color: var(--dm-text-muted);
}

body.ipoji-dark-mode.page-congratulation .congrats-brand-link {
  color: var(--dm-primary);
}
