/* ============================================================
   Quiz App BD — Subscribe (3-step OTP wizard)
   Complements styles.css with the subscription-specific UI.
   ============================================================ */

/* Center the card on the page now that the right-column "Unsubscribe"
   side-panel is gone. We switched to a single-column flexbox so the
   card sits in the middle on every viewport size. */
.subscribe-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-width: 720px;
  margin-inline: auto;
}
.subscribe-wrap > .subscribe-card {
  width: 100%;
}
@media (max-width: 980px) {
  .subscribe-wrap { max-width: 100%; }
}

/* ---------- Subscribe card ---------- */
.subscribe-card {
  position: relative;
  padding: 36px clamp(20px, 4vw, 40px) 40px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  isolation: isolate;
}
.subscribe-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(16,185,129,0.10), transparent 60%),
    radial-gradient(360px 220px at 0% 100%, rgba(37,99,235,0.10), transparent 60%);
  z-index: -1;
}

.subscribe-art {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  box-shadow: var(--shadow-emerald);
  overflow: hidden;
}
.subscribe-blob {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  filter: blur(14px);
  opacity: 0.6;
}
.subscribe-blob-1 { background: rgba(255,255,255,0.35); transform: translate(-20%, -10%); }
.subscribe-blob-2 { background: rgba(255,255,255,0.25); transform: translate(20%, 10%); }
.subscribe-emoji {
  position: relative;
  font-size: 30px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.18));
}

.subscribe-card .section-eyebrow { display: inline-block; }
.subscribe-card .section-title {
  font-size: clamp(22px, 2.8vw, 30px);
  margin: 12px 0 10px;
  text-align: center;
}
.subscribe-card .section-lead { text-align: center; }

/* ---------- Steps ---------- */
.step {
  display: none;
  margin-top: 26px;
  animation: stepIn 360ms var(--easing);
}
.step.step-active { display: block; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.step-badge {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}
.step-head h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--slate-900);
}

/* ---------- Form fields ---------- */
.input-row {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input-row:focus-within {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.12);
}
.input-prefix {
  padding: 14px 14px;
  background: var(--slate-50);
  color: var(--slate-700);
  font-weight: 700;
  font-size: 15.5px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  user-select: none;
}
.input-row input {
  flex: 1;
  padding: 14px 14px;
  border: 0;
  outline: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: transparent;
  min-width: 0;
}
.input-row input::placeholder { color: var(--slate-400); }
.input-row input[type='tel'] { letter-spacing: 0.06em; }

.form-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-soft);
}
.form-hint b {
  color: var(--slate-800);
  font-weight: 700;
}
.link-btn {
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--emerald-700);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: auto;
}
.link-btn:disabled {
  color: var(--slate-400);
  text-decoration: none;
  cursor: not-allowed;
}

.form-error {
  margin: 12px 0 0;
  min-height: 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--red-600);
}
.form-success {
  margin: 12px 0 0;
  min-height: 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--emerald-700);
}

/* ---------- OTP field ---------- */
.otp-input {
  width: 100%;
  padding: 18px 16px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.55em;
  background: #fff;
  outline: 0;
  font-family: 'SF Mono', 'JetBrains Mono', Menlo, monospace;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  text-indent: 0.55em;
}
.otp-input::placeholder { color: var(--slate-300); letter-spacing: 0.55em; }
.otp-input:focus {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.14);
}

/* ---------- Success step ---------- */
.success-state {
  text-align: center;
  padding: 16px 4px 4px;
}
.success-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--emerald-50);
  color: var(--emerald-600);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 8px rgba(16,185,129,0.10);
  animation: pop 600ms var(--easing);
}
.success-icon svg { width: 36px; height: 36px; }
@keyframes pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
.success-state h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--slate-900);
}
#successMessage {
  margin: 8px auto 20px;
  max-width: 36ch;
  color: var(--text-muted);
  font-size: 15px;
}
.success-state .btn-lg { margin-top: 6px; }

/* ---------- Subscribe meta footer ---------- */
.subscribe-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  font-size: 13px;
  color: var(--text-soft);
}
.subscribe-meta .meta-divider { opacity: 0.6; }

/* ---------- Submit button spinner ----------
   The spinner is rendered with the `hidden` HTML attribute on the
   element by default. We deliberately keep it `display: none` in
   THREE ways (attribute default + `.btn-spinner` base + `[hidden]`
   override) so it can never appear as a permanently-rotating ring
   next to "Request OTP" / "Verify & activate" until the form is
   actually submitting.
*/
.btn-spinner {
  display: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 720ms linear infinite;
  margin-left: 6px;
  vertical-align: -2px;
}
/* Belt-and-braces: even if some author CSS adds `display: inline-block`
   further down, the `hidden` attribute always wins. */
.btn-spinner[hidden] { display: none !important; }
/* When the form is busy, subscribe.js removes the `hidden` attribute;
   show the spinner then. */
.btn-spinner:not([hidden]) { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn[disabled] { opacity: 0.7; pointer-events: none; }
.btn .btn-label { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Subscriber dashboard CTA ----------
   Replaces the old "Unsubscribe" card. Only visible to returning
   subscribers who already have an active session in this browser tab.
*/
.subscriber-cta {
  margin-top: 20px;
  width: 100%;
  padding: 22px 22px 20px;
  background:
    linear-gradient(180deg, rgba(16, 185, 129, 0.06), rgba(37, 99, 235, 0.06)),
    #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.subscriber-cta[hidden] { display: none; }
.subscriber-cta-head h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--slate-900);
  margin-top: 8px;
}
.subscriber-cta-head p {
  font-size: 13.5px;
  color: var(--text-soft);
  margin-top: 6px;
}
.subscriber-cta .btn { margin-top: 14px; }
.subscriber-cta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--emerald-500);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
