/* ── Waitlist Wizard v2 ──────────────────────────── */
/* Inherits --bg, --bg-dark, --bg-card, --fg, --dim,
   --purple, --pink, --green, --cyan, --red, --glow,
   --radius, --mono, --sans from parent stylesheet.   */

/* ── Backdrop ───────────────────────────────────── */
.ww-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ww-backdrop.ww-open {
  opacity: 1;
  visibility: visible;
}

/* ── Modal ──────────────────────────────────────── */
.ww-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-dark, #1e1f29);
  border: 1px solid var(--bg-card, #44475a);
  border-radius: calc(var(--radius, 8px) * 2);
  padding: 2.5rem 2rem 2rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5),
              0 0 40px var(--glow, rgba(189, 147, 249, 0.15));
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s ease;
}

.ww-backdrop.ww-open .ww-modal {
  transform: translateY(0) scale(1);
}

/* Close button */
.ww-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--dim, #6272a4);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}
.ww-close:hover {
  color: var(--fg, #f8f8f2);
  background: var(--bg-card, #44475a);
}

/* ── Step Dots ──────────────────────────────────── */
.ww-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.ww-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-card, #44475a);
  transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
}

.ww-dot.ww-active {
  background: var(--purple, #bd93f9);
  box-shadow: 0 0 8px var(--glow, rgba(189, 147, 249, 0.4));
  transform: scale(1.25);
}

.ww-dot.ww-done {
  background: var(--green, #50fa7b);
}

/* ── Steps Container ────────────────────────────── */
.ww-steps {
  position: relative;
  overflow: hidden;
}

.ww-step {
  display: none;
  animation: ww-fadeIn 0.35s ease forwards;
}

.ww-step.ww-visible {
  display: block;
}

@keyframes ww-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Typography ─────────────────────────────────── */
.ww-title {
  font-family: var(--sans, sans-serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--fg, #f8f8f2);
  text-align: center;
  margin-bottom: 0.5rem;
}

.ww-subtitle {
  font-family: var(--sans, sans-serif);
  font-size: 0.85rem;
  color: var(--dim, #6272a4);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 2rem;
}

/* ── OTP Input (Step 1) ────────────────────────── */
.ww-otp-group {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.ww-otp-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-family: var(--mono, monospace);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--fg, #f8f8f2);
  background: var(--bg, #282a36);
  border: 1.5px solid var(--bg-card, #44475a);
  border-radius: var(--radius, 8px);
  outline: none;
  caret-color: var(--purple, #bd93f9);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ww-otp-input:focus {
  border-color: var(--purple, #bd93f9);
  box-shadow: 0 0 0 3px var(--glow, rgba(189, 147, 249, 0.2));
}

.ww-otp-input.ww-otp-filled {
  border-color: var(--green, #50fa7b);
}

.ww-otp-input.ww-otp-error {
  border-color: var(--red, #ff5555);
  animation: ww-shake 0.4s ease;
}

@keyframes ww-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Countdown / Resend */
.ww-otp-footer {
  text-align: center;
  font-family: var(--mono, monospace);
  font-size: 0.75rem;
  color: var(--dim, #6272a4);
  margin-bottom: 0.5rem;
}

.ww-resend {
  color: var(--purple, #bd93f9);
  background: none;
  border: none;
  font-family: var(--mono, monospace);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  transition: opacity 0.2s;
}
.ww-resend:hover { opacity: 0.8; }
.ww-resend:disabled {
  color: var(--dim, #6272a4);
  cursor: not-allowed;
  text-decoration: none;
  opacity: 0.5;
}

/* ── Checkbox List (Step 2) ─────────────────────── */
.ww-check-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.ww-check-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg, #282a36);
  border: 1px solid var(--bg-card, #44475a);
  border-radius: var(--radius, 8px);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

.ww-check-item:hover {
  border-color: var(--purple, #bd93f9);
}

.ww-check-item input[type="checkbox"] {
  display: none;
}

.ww-check-box {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--dim, #6272a4);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}

.ww-check-item input:checked ~ .ww-check-box {
  background: var(--purple, #bd93f9);
  border-color: var(--purple, #bd93f9);
}

.ww-check-box::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--bg-dark, #1e1f29);
  border-bottom: 2px solid var(--bg-dark, #1e1f29);
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
  transition: opacity 0.15s;
}

.ww-check-item input:checked ~ .ww-check-box::after {
  opacity: 1;
}

.ww-check-label {
  font-family: var(--sans, sans-serif);
  font-size: 0.85rem;
  color: var(--fg, #f8f8f2);
}

.ww-privacy-text {
  font-family: var(--sans, sans-serif);
  font-size: 0.72rem;
  color: var(--dim, #6272a4);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* ── GitHub Autocomplete (Step 3) ───────────────── */
.ww-gh-wrap {
  position: relative;
  margin-bottom: 1.5rem;
}

.ww-gh-input {
  width: 100%;
  font-family: var(--mono, monospace);
  font-size: 0.85rem;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg, #282a36);
  border: 1.5px solid var(--bg-card, #44475a);
  border-radius: var(--radius, 8px);
  color: var(--fg, #f8f8f2);
  outline: none;
  transition: border-color 0.2s;
}

.ww-gh-input:focus {
  border-color: var(--purple, #bd93f9);
}

.ww-gh-input::placeholder {
  color: var(--dim, #6272a4);
}

.ww-gh-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--dim, #6272a4);
  pointer-events: none;
}

.ww-gh-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg, #282a36);
  border: 1px solid var(--bg-card, #44475a);
  border-radius: var(--radius, 8px);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.ww-gh-dropdown.ww-gh-open {
  display: block;
}

.ww-gh-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}

.ww-gh-option:hover,
.ww-gh-option.ww-gh-highlight {
  background: var(--bg-card, #44475a);
}

.ww-gh-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ww-gh-name {
  font-family: var(--mono, monospace);
  font-size: 0.8rem;
  color: var(--fg, #f8f8f2);
}

.ww-gh-skip {
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--mono, monospace);
  font-size: 0.75rem;
  color: var(--dim, #6272a4);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
}
.ww-gh-skip:hover {
  color: var(--fg, #f8f8f2);
}

/* ── Confirmation (Step 4) ──────────────────────── */
.ww-confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  background: var(--green, #50fa7b);
  border-radius: 50%;
  animation: ww-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ww-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.ww-confirm-icon svg {
  width: 32px;
  height: 32px;
  color: var(--bg-dark, #1e1f29);
}

.ww-position {
  font-family: var(--mono, monospace);
  font-size: 2rem;
  font-weight: 700;
  color: var(--purple, #bd93f9);
  text-align: center;
  margin-bottom: 0.25rem;
}

.ww-position-label {
  font-family: var(--sans, sans-serif);
  font-size: 0.8rem;
  color: var(--dim, #6272a4);
  text-align: center;
  margin-bottom: 2rem;
}

.ww-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  font-family: var(--mono, monospace);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  background: var(--purple, #bd93f9);
  color: var(--bg, #282a36);
  border: none;
  border-radius: var(--radius, 8px);
  cursor: pointer;
  transition: box-shadow 0.3s, transform 0.2s;
  margin-bottom: 0.5rem;
}
.ww-share-btn:hover {
  box-shadow: 0 0 20px var(--glow, rgba(189, 147, 249, 0.4));
  transform: translateY(-1px);
}

.ww-share-copied {
  font-family: var(--mono, monospace);
  font-size: 0.75rem;
  color: var(--green, #50fa7b);
  text-align: center;
  min-height: 1.2em;
  margin-bottom: 0.5rem;
}

.ww-done-btn {
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--mono, monospace);
  font-size: 0.8rem;
  color: var(--dim, #6272a4);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
}
.ww-done-btn:hover { color: var(--fg, #f8f8f2); }

/* ── Primary action button (reused across steps) ── */
.ww-btn-primary {
  display: block;
  width: 100%;
  font-family: var(--mono, monospace);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  background: var(--purple, #bd93f9);
  color: var(--bg, #282a36);
  border: none;
  border-radius: var(--radius, 8px);
  cursor: pointer;
  transition: box-shadow 0.3s, transform 0.2s, opacity 0.2s;
}
.ww-btn-primary:hover {
  box-shadow: 0 0 20px var(--glow, rgba(189, 147, 249, 0.4));
  transform: translateY(-1px);
}
.ww-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Error message ──────────────────────────────── */
.ww-error {
  font-family: var(--mono, monospace);
  font-size: 0.75rem;
  color: var(--red, #ff5555);
  text-align: center;
  min-height: 1.2em;
  margin-top: 0.75rem;
}

/* ── Spinner ────────────────────────────────────── */
.ww-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg, #282a36);
  border-top-color: transparent;
  border-radius: 50%;
  animation: ww-spin 0.6s linear infinite;
  vertical-align: middle;
}

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

/* ── Responsive: full-screen on mobile ──────────── */
@media (max-width: 520px) {
  .ww-modal {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    padding: 3rem 1.5rem 2rem;
  }

  .ww-backdrop {
    align-items: stretch;
  }

  .ww-otp-input {
    width: 42px;
    height: 50px;
    font-size: 1.2rem;
  }

  .ww-otp-group {
    gap: 0.4rem;
  }
}

/* ── Dark mode fine-tuning (prefers-color-scheme) ── */
/* The landing already uses a dark palette; this
   handles cases where the wizard is embedded on a
   light-mode page elsewhere.                        */
@media (prefers-color-scheme: light) {
  .ww-modal {
    --bg-dark: #ffffff;
    --bg: #f5f5f7;
    --bg-card: #e0e0e4;
    --fg: #1d1d1f;
    --dim: #86868b;
    --glow: rgba(189, 147, 249, 0.25);
    background: var(--bg-dark);
    border-color: var(--bg-card);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18),
                0 0 40px var(--glow);
  }

  .ww-otp-input {
    background: var(--bg);
    border-color: var(--bg-card);
    color: var(--fg);
  }

  .ww-check-item {
    background: var(--bg);
    border-color: var(--bg-card);
  }

  .ww-gh-input {
    background: var(--bg);
    border-color: var(--bg-card);
    color: var(--fg);
  }

  .ww-gh-dropdown {
    background: var(--bg);
    border-color: var(--bg-card);
  }

  .ww-gh-option:hover,
  .ww-gh-option.ww-gh-highlight {
    background: var(--bg-card);
  }
}
