/* ═══════════════════════════════════════════════════════════════════
   wizard.css — Prinda Intelligence Wizard styles
   All styles scoped to .pw-* prefixes. No :root{} writes.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Overlay ── */
#pw-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

#pw-overlay.pw-visible {
  display: flex;
}

.pw-body-lock {
  overflow: hidden;
}

/* ── Card ── */
.pw-card {
  background: var(--card-bg, #fff);
  color: var(--text, #0a2540);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 32px 28px 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  outline: none;
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Default (light) app mode — force white card even when OS is in dark mode.
   body:not([class*="theme-"]) covers the unthemed default state.            */
body:not([class*="theme-"]) .pw-card,
body.theme-default .pw-card {
  background: var(--card-bg, #fff) !important;
  color: var(--text, #0a2540) !important;
}

/* Dark theme support (OS) — only fires when no app-theme override is present */
@media (prefers-color-scheme: dark) {
  .pw-card {
    background: var(--card-bg, #1a1a2e);
    color: var(--text, #e8e8f0);
  }
}

body.theme-dark .pw-card,
body.theme-midnight .pw-card,
body.theme-dazzle .pw-card,
body.theme-nature .pw-card,
body.theme-sunset .pw-card {
  background: #1a1a2e;
  color: #e8e8f0;
}

/* ── Progress dots ── */
.pw-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.pw-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0e0e0;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.pw-dot-active {
  background: #6C3CE1;
  transform: scale(1.4);
  box-shadow: 0 0 0 3px rgba(108, 60, 225, 0.2);
}

.pw-dot-done {
  background: #a78bfa;
}

/* ── Body ── */
.pw-body {
  min-height: 180px;
}

/* ── Headings ── */
.pw-step-heading {
  font-size: 1.3rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
  line-height: 1.35;
}

.pw-step-sub {
  font-size: 0.92rem;
  color: #666;
  margin-bottom: 24px;
  line-height: 1.5;
}

body.theme-dark .pw-step-heading,
body.theme-midnight .pw-step-heading,
body.theme-dazzle .pw-step-heading,
body.theme-nature .pw-step-heading,
body.theme-sunset .pw-step-heading {
  color: #f0eaff;
}

body.theme-dark .pw-step-sub,
body.theme-midnight .pw-step-sub,
body.theme-dazzle .pw-step-sub,
body.theme-nature .pw-step-sub,
body.theme-sunset .pw-step-sub {
  color: #aaa;
}

/* ── Form groups ── */
.pw-form-group {
  margin-bottom: 18px;
}

.pw-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 7px;
}

body.theme-dark .pw-label,
body.theme-midnight .pw-label,
body.theme-dazzle .pw-label,
body.theme-nature .pw-label,
body.theme-sunset .pw-label {
  color: #b0a8c8;
}

.pw-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.95rem;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  outline: none;
  background: #fafafa;
  color: #222;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  min-height: 44px;
}

.pw-input:focus {
  border-color: #6C3CE1;
  box-shadow: 0 0 0 3px rgba(108, 60, 225, 0.12);
  background: #fff;
}

body.theme-dark .pw-input,
body.theme-midnight .pw-input,
body.theme-dazzle .pw-input,
body.theme-nature .pw-input,
body.theme-sunset .pw-input {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: #e8e8f0;
}

body.theme-dark .pw-input:focus,
body.theme-midnight .pw-input:focus,
body.theme-dazzle .pw-input:focus {
  background: rgba(255,255,255,0.12);
  border-color: #a78bfa;
}

.pw-select {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.92rem;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  outline: none;
  background: #fafafa;
  color: #222;
  cursor: pointer;
  min-height: 44px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.pw-select:focus {
  border-color: #6C3CE1;
  box-shadow: 0 0 0 3px rgba(108, 60, 225, 0.12);
}

body.theme-dark .pw-select,
body.theme-midnight .pw-select,
body.theme-dazzle .pw-select {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: #e8e8f0;
}

/* ── Pill grids ── */
.pw-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.pw-gathering-grid {
  gap: 10px;
}

.pw-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1.5px solid #ddd;
  border-radius: 30px;
  background: #f5f5f5;
  color: #444;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  min-height: 44px;
  user-select: none;
  white-space: nowrap;
}

.pw-pill:hover {
  border-color: #6C3CE1;
  background: rgba(108, 60, 225, 0.06);
  color: #6C3CE1;
}

.pw-pill:focus-visible {
  outline: 2px solid #6C3CE1;
  outline-offset: 2px;
}

.pw-pill-active {
  border-color: #6C3CE1;
  background: #6C3CE1;
  color: #fff;
  box-shadow: 0 2px 8px rgba(108, 60, 225, 0.3);
}

.pw-pill-active:hover {
  background: #5a2fc4;
  color: #fff;
}

.pw-pill-emoji {
  font-size: 1rem;
  line-height: 1;
}

body.theme-dark .pw-pill,
body.theme-midnight .pw-pill,
body.theme-dazzle .pw-pill,
body.theme-nature .pw-pill,
body.theme-sunset .pw-pill {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  color: #c8b8e8;
}

body.theme-dark .pw-pill:hover,
body.theme-midnight .pw-pill:hover,
body.theme-dazzle .pw-pill:hover {
  border-color: #a78bfa;
  background: rgba(167,139,250,0.12);
  color: #c4a8ff;
}

/* ── Hint ── */
.pw-hint {
  font-size: 0.82rem;
  color: #f59e0b;
  margin-top: 6px;
  padding: 6px 12px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 8px;
  border-left: 3px solid #f59e0b;
}

/* ── Skip link ── */
.pw-skip-link {
  background: none;
  border: none;
  color: #999;
  font-size: 0.83rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.pw-skip-link:hover {
  color: #6C3CE1;
}

.pw-skip-link:focus-visible {
  outline: 2px solid #6C3CE1;
  outline-offset: 2px;
  border-radius: 4px;
}

.pw-skip-step1 {
  display: block;
  margin-top: 14px;
}

/* ── Footer ── */
.pw-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid #eee;
  gap: 12px;
}

.pw-footer-left,
.pw-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

body.theme-dark .pw-footer,
body.theme-midnight .pw-footer,
body.theme-dazzle .pw-footer,
body.theme-nature .pw-footer,
body.theme-sunset .pw-footer {
  border-top-color: rgba(255,255,255,0.1);
}

/* ── Buttons ── */
.pw-btn-primary {
  padding: 11px 24px;
  background: #6C3CE1;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  min-height: 44px;
  min-width: 100px;
}

.pw-btn-primary:hover {
  background: #5a2fc4;
  box-shadow: 0 4px 12px rgba(108, 60, 225, 0.3);
}

.pw-btn-primary:active {
  transform: scale(0.97);
}

.pw-btn-primary:focus-visible {
  outline: 2px solid #6C3CE1;
  outline-offset: 3px;
}

.pw-btn-ghost {
  padding: 11px 18px;
  background: transparent;
  color: #666;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  min-height: 44px;
}

.pw-btn-ghost:hover {
  border-color: #aaa;
  color: #333;
}

.pw-btn-ghost:focus-visible {
  outline: 2px solid #6C3CE1;
  outline-offset: 2px;
}

body.theme-dark .pw-btn-ghost,
body.theme-midnight .pw-btn-ghost,
body.theme-dazzle .pw-btn-ghost {
  border-color: rgba(255,255,255,0.18);
  color: #aaa;
}

.pw-btn-lg {
  padding: 14px 36px;
  font-size: 1rem;
  min-width: 160px;
}

/* ── Status ── */
.pw-status {
  display: none;
  font-size: 0.82rem;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 6px;
}

.pw-status-error {
  color: #dc2626;
  background: rgba(220,38,38,0.08);
}

.pw-status-info {
  color: #2563eb;
  background: rgba(37,99,235,0.08);
}

/* ── Completion screen ── */
.pw-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0 12px;
  gap: 12px;
}

.pw-complete-icon {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 4px;
}

.pw-complete-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111;
}

body.theme-dark .pw-complete-heading,
body.theme-midnight .pw-complete-heading,
body.theme-dazzle .pw-complete-heading {
  color: #f0eaff;
}

.pw-complete-sub {
  font-size: 0.95rem;
  color: #666;
  max-width: 340px;
  line-height: 1.55;
  margin-bottom: 8px;
}

body.theme-dark .pw-complete-sub,
body.theme-midnight .pw-complete-sub {
  color: #aaa;
}

/* ── Gatherings tab banner ── */
.pw-gatherings-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 18px;
  background: linear-gradient(135deg, rgba(108,60,225,0.12), rgba(168,85,247,0.08));
  border: 1px solid rgba(108, 60, 225, 0.25);
  border-radius: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pw-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.pw-banner-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.pw-banner-text {
  font-size: 0.88rem;
  color: var(--text, #333);
  line-height: 1.4;
}

.pw-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pw-banner-primary {
  padding: 8px 16px;
  background: #6C3CE1;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  transition: background 0.15s;
}

.pw-banner-primary:hover {
  background: #5a2fc4;
}

.pw-banner-primary:focus-visible {
  outline: 2px solid #6C3CE1;
  outline-offset: 2px;
}

.pw-banner-ghost {
  padding: 8px 12px;
  background: transparent;
  color: var(--muted, #888);
  border: none;
  font-size: 0.82rem;
  cursor: pointer;
  min-height: 36px;
  transition: color 0.15s;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pw-banner-ghost:hover {
  color: var(--text, #333);
}

.pw-banner-ghost:focus-visible {
  outline: 2px solid #6C3CE1;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .pw-card {
    padding: 24px 20px 20px;
    border-radius: 16px;
  }

  .pw-step-heading {
    font-size: 1.15rem;
  }

  .pw-gathering-grid {
    gap: 8px;
  }

  .pw-footer {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .pw-footer-left,
  .pw-footer-right {
    width: 100%;
    justify-content: center;
  }

  .pw-btn-primary,
  .pw-btn-ghost {
    width: 100%;
    justify-content: center;
  }

  .pw-gatherings-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .pw-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pw-dot,
  .pw-pill,
  .pw-btn-primary,
  .pw-btn-ghost {
    transition: none;
  }
}
