/* ==========================================================================
   MOPPLSIA Public Portal — Minimalist Zero-Leak Gate, Form & Receipt
   ========================================================================== */

.portal-main {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.75rem 1.25rem 3.5rem;
}

/* Seamless Floating Video Logo */
.portal-logo-stage {
  margin-bottom: 1.35rem;
  animation: fadeInUp 0.8s var(--ease-apple) both;
}

.portal-hero-video {
  width: 176px;
  height: 126px;
}

/* Stage Container */
.portal-stage {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

.portal-view {
  display: none;
}

.portal-view.is-active {
  display: block;
  animation: viewReveal 0.62s var(--ease-apple) both;
}

.portal-view.is-leaving {
  display: block;
  animation: viewExit 0.28s var(--ease-apple) forwards;
  pointer-events: none;
}

@keyframes viewReveal {
  from {
    opacity: 0;
    transform: translate3d(0, 22px, 0) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes viewExit {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate3d(0, -14px, 0) scale(0.975);
  }
}

/* ==========================================================================
   STAGE 1: Zero-Leak Reference Code Gate
   ========================================================================== */

.gate-card {
  max-width: 450px;
  margin: 0 auto;
  padding: 2.35rem 2.1rem 2.1rem;
  text-align: center;
}

.gate-title {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-white);
  margin-bottom: 0.45rem;
}

.gate-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.ref-gate-form {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}

.ref-code-field {
  position: relative;
}

.ref-code-input {
  width: 100%;
  height: 58px;
  padding: 0 2.9rem 0 1.2rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.038);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1.04rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.ref-code-input::placeholder {
  letter-spacing: 0.08em;
  font-weight: 400;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.26);
}

.ref-code-input:focus {
  background: rgba(255, 255, 255, 0.068);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.075);
}

.ref-code-input.is-shaking {
  animation: appleShake 0.42s ease both;
  border-color: rgba(255, 90, 90, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 90, 90, 0.14);
}

.gate-clear-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.7);
  display: none;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.gate-clear-btn.visible {
  display: grid;
}

.gate-clear-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.gate-error-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 0.95rem;
  border-radius: 13px;
  background: rgba(255, 80, 80, 0.09);
  border: 1px solid rgba(255, 90, 90, 0.28);
  color: #ff8585;
  font-size: 0.83rem;
  font-weight: 500;
}

.gate-error-banner.visible {
  display: flex;
  animation: fadeSlideDown 0.24s var(--ease-apple);
}

/* ==========================================================================
   STAGE 1B: IP Banned / Rate-Limited View
   ========================================================================== */

.ban-card {
  max-width: 450px;
  margin: 0 auto;
  padding: 2.5rem 2.1rem;
  text-align: center;
}

.ban-shield-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: rgba(255, 90, 90, 0.12);
  border: 1px solid rgba(255, 90, 90, 0.34);
  display: grid;
  place-items: center;
  color: #ff8080;
  animation: banPulse 2.4s ease-in-out infinite alternate;
}

@keyframes banPulse {
  from { transform: scale(0.96); opacity: 0.8; }
  to { transform: scale(1.04); opacity: 1; }
}

.ban-until-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.42rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   STAGE 2: Unlocked Application Form
   ========================================================================== */

.form-card {
  padding: 2.4rem 2.3rem 2.2rem;
}

.verified-invite-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.042);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.verified-invite-strip__left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.86);
}

.verified-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.7);
}

.change-code-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.change-code-link:hover {
  color: #ffffff;
}

.form-card__header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.card-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.4rem;
}

.card-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.application-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.portal-view.is-active .stagger-field {
  animation: fadeInUp 0.55s var(--ease-apple) both;
}
.portal-view.is-active .stagger-field:nth-child(1) { animation-delay: 0.04s; }
.portal-view.is-active .stagger-field:nth-child(2) { animation-delay: 0.08s; }
.portal-view.is-active .stagger-field:nth-child(3) { animation-delay: 0.12s; }
.portal-view.is-active .stagger-field:nth-child(4) { animation-delay: 0.16s; }
.portal-view.is-active .stagger-field:nth-child(5) { animation-delay: 0.20s; }
.portal-view.is-active .stagger-field:nth-child(6) { animation-delay: 0.24s; }
.portal-view.is-active .stagger-field:nth-child(7) { animation-delay: 0.28s; }
.portal-view.is-active .stagger-field:nth-child(8) { animation-delay: 0.32s; }

/* Locked Referral Code Box */
.locked-ref-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.form-control.is-locked-ref {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(255, 255, 255, 0.048);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding-right: 9.2rem;
  cursor: not-allowed;
  user-select: all;
}

.locked-ref-tag {
  position: absolute;
  right: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  pointer-events: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Country Selector */
.phone-combo {
  display: flex;
  gap: 0.55rem;
  position: relative;
}

.country-selector {
  position: relative;
  flex-shrink: 0;
}

.country-btn {
  height: 48px;
  min-width: 114px;
  padding: 0 0.72rem;
  border-radius: 14px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  cursor: pointer;
  transition: border-color 0.22s ease;
}

.country-btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.country-iso-badge {
  padding: 0.15rem 0.36rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.7rem;
  font-weight: 700;
}

.country-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 276px;
  max-height: 280px;
  border-radius: 16px;
  background: rgba(16, 16, 20, 0.96);
  backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.9);
  padding: 0.6rem;
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 0.45rem;
}

.country-dropdown.open {
  display: flex;
  animation: fadeSlideDown 0.2s var(--ease-apple);
}

.country-search {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
}

.country-list {
  overflow-y: auto;
  max-height: 210px;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.country-item {
  width: 100%;
  padding: 0.48rem 0.65rem;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-family: inherit;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.country-item:hover,
.country-item.active {
  background: rgba(255, 255, 255, 0.1);
}

.country-item__left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.country-item__dial {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.char-counter {
  font-size: 0.73rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

/* ==========================================================================
   STAGE 3: Compact Application Receipt Summary Card
   ========================================================================== */

.summary-card {
  max-width: 540px;
  margin: 0 auto;
  padding: 2.3rem 2.1rem 2rem;
}

.summary-top {
  text-align: center;
  margin-bottom: 1.65rem;
}

.success-check-wrap {
  position: relative;
  width: 66px;
  height: 66px;
  margin: 0 auto 1.2rem;
  display: grid;
  place-items: center;
}

.success-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.32);
  animation: pulseRing 2.2s ease-in-out infinite alternate;
}

.success-circle {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.22), rgba(52, 211, 153, 0.08));
  border: 1px solid rgba(52, 211, 153, 0.48);
  display: grid;
  place-items: center;
}

.success-check-svg {
  width: 24px;
  height: 24px;
  stroke: #6ee7b7;
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.success-check-path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: drawCheck 0.75s var(--ease-apple) 0.15s forwards;
}

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

@keyframes pulseRing {
  from { transform: scale(0.95); opacity: 0.7; }
  to { transform: scale(1.08); opacity: 1; }
}

.summary-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.28);
  color: #6ee7b7;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.summary-status-pill.is-pending {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.28);
  color: #fcd34d;
}

.summary-status-pill.is-rejected {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.3);
  color: #fca5a5;
}

.summary-receipt-box {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid rgba(255, 255, 255, 0.09);
  padding: 1.2rem;
  margin-bottom: 1.4rem;
}

.summary-ref-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.summary-ref-control {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.ref-visibility-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  padding: 0.3rem 0.68rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.82);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease-apple);
}

.ref-visibility-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.ref-visibility-btn:active {
  transform: scale(0.96);
}

.summary-ref-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
}

.summary-ref-code {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #ffffff;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.1rem;
}

.summary-field {
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
}

.summary-field--full {
  grid-column: 1 / -1;
}

.summary-field__label {
  font-size: 0.71rem;
  color: var(--text-subtle);
}

.summary-field__value {
  font-size: 0.87rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  word-break: break-word;
}

.summary-actions {
  display: flex;
  justify-content: center;
}

@media (max-width: 720px) {
  .form-card,
  .gate-card,
  .summary-card,
  .ban-card {
    padding: 1.7rem 1.25rem 1.55rem;
  }

  .form-row,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .verified-invite-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-control.is-locked-ref {
    padding-right: 1rem;
  }

  .locked-ref-tag {
    position: static;
    margin-top: 0.45rem;
    align-self: flex-start;
  }

  .locked-ref-wrap {
    flex-direction: column;
    align-items: stretch;
  }
}
