/* ============================================================
   PROFILE WIZARD — Mobile-First Styles
   Uses the shared Airy Flow theme variables from portal-style.css.
   ============================================================ */

#profile-wizard {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  min-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", sans-serif;
}

#profile-wizard *,
#profile-wizard *::before,
#profile-wizard *::after {
  box-sizing: border-box;
}

#profile-wizard.wz-visible {
  display: flex;
}

.wz-topbar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 1rem;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--card);
}

[data-theme="dark"] .wz-topbar {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.wz-brand {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
}

.wz-brand-logo {
  display: block;
  width: auto;
  height: 28px;
  flex-shrink: 0;
}

.wz-progress-wrap {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
}

.wz-progress-track {
  height: 4px;
  flex: 1;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .wz-progress-track {
  background: rgba(255, 255, 255, 0.12);
}

.wz-progress-fill {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: var(--brand);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.wz-step-pill {
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.55;
  white-space: nowrap;
}

.wz-body {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: pan-y;
}

.wz-screen {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 28px 20px 24px;
  opacity: 0;
  transform: translateX(100%);
  -webkit-overflow-scrolling: touch;
  will-change: transform, opacity;
}

.wz-screen.wz-active {
  opacity: 1;
  transform: translateX(0);
  transition:
    transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease;
}

.wz-screen.wz-exit-fwd {
  pointer-events: none;
  opacity: 0;
  transform: translateX(-40%);
  transition:
    transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease;
}

.wz-screen.wz-exit-back {
  pointer-events: none;
  opacity: 0;
  transform: translateX(40%);
  transition:
    transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease;
}

.wz-screen.wz-enter-fwd {
  opacity: 0;
  transform: translateX(100%);
  transition: none;
}

.wz-screen.wz-enter-back {
  opacity: 0;
  transform: translateX(-100%);
  transition: none;
}

.wz-inner {
  max-width: 520px;
  margin: 0 auto;
}

.wz-footer {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--card);
}

[data-theme="dark"] .wz-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.wz-footer-right {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.wz-back-btn,
.wz-skip-btn,
.wz-next-btn,
.wz-btn-primary,
.wz-btn-secondary {
  min-height: 44px;
  font-family: inherit;
  cursor: pointer;
}

.wz-back-btn {
  padding: 10px 20px;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  background: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.7;
  transition: border-color 0.18s, opacity 0.18s;
}

[data-theme="dark"] .wz-back-btn {
  border-color: rgba(255, 255, 255, 0.2);
}

.wz-back-btn:hover,
.wz-back-btn:focus-visible {
  border-color: var(--brand);
  opacity: 1;
}

.wz-skip-btn {
  padding: 10px 4px;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0.5;
  text-decoration: underline;
}

.wz-skip-btn:hover,
.wz-skip-btn:focus-visible {
  opacity: 0.75;
}

.wz-next-btn {
  padding: 12px 28px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: opacity 0.18s, transform 0.15s;
}

.wz-next-btn:hover,
.wz-next-btn:focus-visible {
  opacity: 0.88;
}

.wz-next-btn:active {
  transform: scale(0.97);
}

.wz-next-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.wz-q-icon {
  margin-bottom: 8px;
  font-size: 2.2rem;
  line-height: 1;
}

.wz-q-title {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
}

.wz-q-hint {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 0.87rem;
  line-height: 1.5;
  opacity: 0.58;
}

.wz-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.wz-type-card {
  width: 100%;
  min-width: 0;
  min-height: 112px;
  padding: 20px 14px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

[data-theme="dark"] .wz-type-card {
  border-color: rgba(255, 255, 255, 0.1);
}

.wz-type-card:hover,
.wz-type-card:focus-visible,
.wz-type-card.wz-selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, var(--card));
  box-shadow: 0 2px 14px color-mix(in srgb, var(--brand) 20%, transparent);
  outline: none;
}

.wz-type-icon {
  margin-bottom: 8px;
  font-size: 1.8rem;
}

.wz-type-label {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
}

.wz-type-sub {
  margin-top: 3px;
  color: var(--text);
  font-size: 0.76rem;
  opacity: 0.52;
  overflow-wrap: anywhere;
}

.wz-radio-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wz-radio-card {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.18s, background 0.18s;
}

[data-theme="dark"] .wz-radio-card {
  border-color: rgba(255, 255, 255, 0.1);
}

.wz-radio-card:hover,
.wz-radio-card:focus-visible,
.wz-radio-card.wz-selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
  outline: none;
}

.wz-radio-dot {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  transition: border-color 0.18s;
}

[data-theme="dark"] .wz-radio-dot {
  border-color: rgba(255, 255, 255, 0.25);
}

.wz-radio-dot::after {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand);
  content: "";
  opacity: 0;
  transition: opacity 0.18s;
}

.wz-radio-card.wz-selected .wz-radio-dot {
  border-color: var(--brand);
}

.wz-radio-card.wz-selected .wz-radio-dot::after {
  opacity: 1;
}

.wz-radio-label {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
}

.wz-radio-sub {
  margin-top: 2px;
  color: var(--text);
  font-size: 0.82rem;
  opacity: 0.52;
}

.wz-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.wz-chip-group-label {
  width: 100%;
  margin-top: 8px;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.48;
  text-transform: uppercase;
}

.wz-chip {
  min-height: 44px;
  padding: 9px 16px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 99px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

[data-theme="dark"] .wz-chip {
  border-color: rgba(255, 255, 255, 0.12);
}

.wz-chip:hover,
.wz-chip:focus-visible {
  border-color: var(--brand);
  outline: none;
}

.wz-chip.wz-selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.wz-text-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  padding: 14px 16px;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  outline: none;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.18s;
}

[data-theme="dark"] .wz-text-input {
  border-color: rgba(255, 255, 255, 0.15);
}

.wz-text-input:focus {
  border-color: var(--brand);
}

.wz-input-narrow {
  max-width: 360px;
}

.wz-custom-chip-wrap {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.wz-custom-chip-input {
  flex: 1;
}

.wz-inline-skip {
  margin: 16px 0 0;
  text-align: center;
}

.wz-publish-screen {
  padding-top: 2rem;
  text-align: center;
}

.wz-publish-icon {
  margin-bottom: 12px;
  font-size: 3.5rem;
}

.wz-publish-title {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 800;
}

.wz-publish-sub {
  margin: 0 0 24px;
  color: var(--text);
  font-size: 0.95rem;
  opacity: 0.62;
}

.wz-strength {
  max-width: 360px;
  margin: 0 auto 1.5rem;
}

.wz-strength-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
}

.wz-completeness-bar-wrap {
  height: 8px;
  margin: 6px 0 20px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .wz-completeness-bar-wrap {
  background: rgba(255, 255, 255, 0.1);
}

.wz-completeness-bar {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: var(--brand);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.wz-publish-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.wz-btn-primary,
.wz-btn-secondary {
  min-height: 48px;
  padding: 13px 28px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
}

.wz-btn-primary {
  border: 0;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.wz-btn-secondary {
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  background: none;
  color: var(--text);
}

[data-theme="dark"] .wz-btn-secondary {
  border-color: rgba(255, 255, 255, 0.15);
}

.wz-btn-primary:disabled,
.wz-btn-secondary:disabled {
  cursor: wait;
  opacity: 0.55;
}

.wz-save-error {
  margin: 14px 0 0;
  color: var(--text);
  font-size: 0.83rem;
  opacity: 0.72;
}

.wz-tips-card {
  max-width: 400px;
  margin: 0 auto 20px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
  text-align: left;
}

.wz-tips-label {
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
}

.wz-tips-item {
  padding: 2px 0;
  color: var(--text);
  font-size: 0.82rem;
  opacity: 0.72;
}

@media (max-width: 420px) {
  .wz-topbar,
  .wz-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .wz-screen {
    padding-right: 16px;
    padding-left: 16px;
  }

  .wz-back-btn {
    padding-right: 12px;
    padding-left: 12px;
  }

  .wz-next-btn {
    padding-right: 18px;
    padding-left: 18px;
  }
}

@media (max-width: 360px) {
  .wz-type-grid {
    grid-template-columns: 1fr;
  }

  .wz-footer-right {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wz-progress-fill,
  .wz-screen,
  .wz-completeness-bar {
    transition-duration: 0.01ms !important;
  }
}
