/* ============================================
   WizGuide - dbt-wizard guided tour
   Pure CSS, no framework. Inherits design tokens
   from site.css. The agent narrates from a side
   panel; the focused page element gets a soft
   pulsing outline instead of a darkening overlay.
   ============================================ */

:root {
  --wg-panel-w: 380px;
  --wg-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Floating action button ---------- */
.wg-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-indigo), #8C7BFF);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  box-shadow:
    0 8px 24px rgba(111, 91, 239, 0.45),
    0 0 0 0 rgba(111, 91, 239, 0.55);
  transition: transform 0.18s var(--wg-ease), box-shadow 0.25s ease, background 0.2s ease;
}
.wg-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 12px 30px rgba(111, 91, 239, 0.55),
    0 0 0 6px rgba(111, 91, 239, 0.18);
}
.wg-fab[aria-expanded="true"] {
  background: var(--c-navy);
  transform: rotate(45deg);
}
.wg-fab[aria-expanded="true"] .wg-fab-mark { opacity: 0; }
.wg-fab[aria-expanded="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  background-size: 16px 16px;
  background-position: center;
  background-repeat: no-repeat;
}

.wg-fab-label {
  position: absolute;
  right: 68px;
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: var(--c-navy);
  color: #fff;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: var(--shadow-md);
}
.wg-fab:hover .wg-fab-label,
.wg-fab:focus-visible .wg-fab-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* First-visit pulse ring on the FAB */
.wg-fab.wg-fab-nudge::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--c-indigo);
  animation: wg-nudge 1.8s ease-out 0.4s 3;
  pointer-events: none;
}
.wg-fab.wg-fab-nudge .wg-fab-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-orange);
  box-shadow: 0 0 0 2px #fff, 0 0 10px var(--c-orange);
}
@keyframes wg-nudge {
  0%   { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.6);  opacity: 0;   }
}

/* ---------- Side panel ---------- */
.wg-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: var(--wg-panel-w);
  max-width: 92vw;
  background: var(--c-card);
  box-shadow: -18px 0 48px rgba(14, 26, 64, 0.18);
  z-index: 8999;
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform 0.32s var(--wg-ease);
  border-left: 1px solid var(--c-border);
}
.wg-panel.is-open { transform: translateX(0); }

.wg-scrim {
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 42, 0.10);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 8998;
}
.wg-scrim.is-on { opacity: 1; }

.wg-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--c-border);
  background: linear-gradient(180deg, #FBFAFF 0%, #FFFFFF 100%);
}
.wg-head-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--c-indigo), var(--c-snow));
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.wg-head-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.wg-head-title strong {
  color: var(--c-navy);
  font-size: 0.98rem;
}
.wg-head-title span {
  color: var(--c-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wg-head-close {
  border: none;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wg-head-close:hover { background: #F1EEFF; color: var(--c-navy); }

/* ---------- Message body ---------- */
.wg-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1rem 1.2rem;
  scroll-behavior: smooth;
}
.wg-body::-webkit-scrollbar { width: 6px; }
.wg-body::-webkit-scrollbar-thumb { background: #E0DDF0; border-radius: 3px; }

.wg-msg {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
  opacity: 0;
  transform: translateY(8px);
  animation: wg-msg-in 0.32s var(--wg-ease) forwards;
}
@keyframes wg-msg-in {
  to { opacity: 1; transform: translateY(0); }
}
.wg-msg .wg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-indigo), var(--c-snow));
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.wg-msg .wg-avatar::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-success);
  border: 2px solid #fff;
}
.wg-msg.is-thinking .wg-avatar::after {
  background: var(--c-orange);
  animation: wg-blink 0.8s ease-in-out infinite;
}
@keyframes wg-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.wg-msg-content {
  min-width: 0;
}
.wg-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #F1EEFF;
  color: var(--c-indigo);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
  border: 1px solid #E0DAFF;
  opacity: 0;
  transform: translateY(4px);
  animation: wg-tool-in 0.22s var(--wg-ease) forwards;
}
.wg-tool::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-indigo);
  box-shadow: 0 0 6px var(--c-indigo);
  animation: wg-blink 0.9s ease-in-out infinite;
}
.wg-tool.is-done::before { animation: none; opacity: 0.4; }
@keyframes wg-tool-in {
  to { opacity: 1; transform: translateY(0); }
}
.wg-tool .wg-tool-bracket {
  color: var(--c-muted);
  font-weight: 500;
}

.wg-text {
  color: var(--c-slate);
  font-size: 0.96rem;
  line-height: 1.55;
  font-family: var(--font-sans);
}
.wg-text code {
  background: rgba(111, 91, 239, 0.10);
  color: var(--c-navy);
  padding: 0.08em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88em;
}
.wg-text strong { color: var(--c-navy); }

.wg-cursor {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  background: var(--c-indigo);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: wg-caret 0.9s steps(2, end) infinite;
  border-radius: 1px;
}
@keyframes wg-caret {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.wg-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}
.wg-action {
  appearance: none;
  border: 1px solid var(--c-border);
  background: #fff;
  color: var(--c-navy);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.wg-action:hover {
  background: #F4F2FF;
  border-color: #C9C0FF;
  transform: translateY(-1px);
}
.wg-action.is-primary {
  background: var(--c-indigo);
  color: #fff;
  border-color: var(--c-indigo);
}
.wg-action.is-primary:hover { background: #5946d8; }

/* ---------- Footer with progress + nav ---------- */
.wg-foot {
  border-top: 1px solid var(--c-border);
  padding: 0.7rem 1rem 0.9rem;
  background: #FBFAFF;
}
.wg-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.wg-progress-bar {
  flex: 1;
  height: 4px;
  background: #E5E2F5;
  border-radius: 999px;
  overflow: hidden;
}
.wg-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--c-indigo), var(--c-snow));
  border-radius: 999px;
  transition: width 0.32s var(--wg-ease);
}
.wg-progress-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--c-muted);
  font-weight: 600;
  white-space: nowrap;
}

.wg-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.wg-nav-btn {
  appearance: none;
  border: 1px solid var(--c-border);
  background: #fff;
  color: var(--c-navy);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.wg-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.wg-nav-btn:not(:disabled):hover {
  background: #F4F2FF;
  border-color: #C9C0FF;
}
.wg-nav-btn.is-primary {
  background: var(--c-indigo);
  color: #fff;
  border-color: var(--c-indigo);
}
.wg-nav-btn.is-primary:not(:disabled):hover { background: #5946d8; }

.wg-skip {
  display: block;
  text-align: center;
  margin-top: 0.55rem;
  color: var(--c-muted);
  font-size: 0.78rem;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  font-family: var(--font-sans);
}
.wg-skip:hover { color: var(--c-indigo); text-decoration: underline; }
.wg-keys {
  margin-top: 0.4rem;
  text-align: center;
  color: var(--c-muted);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}
.wg-keys kbd {
  background: #fff;
  border: 1px solid var(--c-border);
  border-bottom-width: 2px;
  padding: 0.05rem 0.32rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--c-navy);
}

/* ---------- Spotlight: soft glow, no scrim cutout ---------- */
.wg-spotlighted {
  position: relative;
  z-index: 1;
  border-radius: 8px;
  animation: wg-pulse 2.2s ease-in-out infinite;
  scroll-margin-top: 100px;
  scroll-margin-bottom: 100px;
}
@keyframes wg-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 3px var(--c-indigo),
      0 0 0 8px rgba(111, 91, 239, 0.22),
      0 0 38px 10px rgba(111, 91, 239, 0.30);
  }
  50% {
    box-shadow:
      0 0 0 3px var(--c-indigo),
      0 0 0 12px rgba(111, 91, 239, 0.12),
      0 0 52px 16px rgba(111, 91, 239, 0.18);
  }
}
.wg-ping {
  animation: wg-ping 0.7s var(--wg-ease) 1;
}
@keyframes wg-ping {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0   rgba(255, 105, 74, 0.7); }
  60%  { transform: scale(1.015); box-shadow: 0 0 0 18px rgba(255, 105, 74, 0); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(255, 105, 74, 0); }
}

/* On small screens the panel goes full-width */
@media (max-width: 820px) {
  .wg-panel { width: min(420px, 92vw); }
  .wg-fab { right: 16px; bottom: 16px; }
}
@media (max-width: 640px) {
  .wg-panel { width: 100vw; max-width: 100vw; border-left: none; }
  .wg-fab { right: 14px; bottom: 14px; width: 52px; height: 52px; }
  .wg-msg { padding: 0.85rem 1rem; }
  .wg-body { font-size: 0.95rem; }
}
@media (max-width: 480px) {
  .wg-fab { right: 12px; bottom: 12px; width: 48px; height: 48px; }
  .wg-fab .wg-fab-label { display: none; }
}

/* Hide everything for print so the prompt sheet prints clean. */
@media print {
  .wg-fab, .wg-panel, .wg-scrim { display: none !important; }
  .wg-spotlighted { animation: none !important; box-shadow: none !important; }
}
