/* Reusable Website Info editor — used in the new-project wizard's done view
   and inside a modal on the project knowledge page. */

.wie {
  display: flex;
  gap: 18px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* ── Main pane: the full document, all sections stacked ── */
.wie-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.wie-main-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg, 16px);
  background: var(--bg-alt);
  padding: 22px 24px;
}

/* ── Full document: every section stacked, all editable at once ── */
.wie-doc {
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.wie-sec { scroll-margin-top: 6px; }
.wie-sec-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
  word-break: break-word;
}
.wie-sec-title.is-sub { font-size: 15.5px; color: var(--text); }
/* Auto-grows with content (autosize() sets height from scrollHeight) rather
   than scrolling internally — the whole document scrolls as one page. */
.wie-sec-body {
  display: block;
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}
.wie-sec-body::placeholder { color: var(--text-muted); }
.wie-empty { color: var(--text-muted); font-size: 14px; padding: 48px 20px; text-align: center; }

.wie-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}
.wie-saved-note { margin-right: auto; font-size: 12.5px; color: var(--success); font-weight: 600; }
.wie-btn {
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
}
.wie-btn-ghost { background: var(--glass); border-color: var(--glass-border); color: var(--text); }
.wie-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.wie-btn-primary { background: var(--gradient-1); color: #fff; }
.wie-btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(96,165,250,.28); }
.wie-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

/* ── Outline pane ── */
.wie-side {
  flex: 0 0 250px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg, 16px);
  background: var(--bg-alt);
  overflow: hidden;
}
.wie-side-fullscreen-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border: none;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.wie-side-fullscreen-btn:hover { color: var(--accent); background: var(--surface-hover); }
.wie-side-fullscreen-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.wie-side-fullscreen-btn.is-active { color: var(--accent); }
.wie-side-head {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
}
.wie-side-list { flex: 1 1 auto; overflow-y: auto; padding: 8px; }
.wie-side-item {
  display: flex;
  align-items: center;
  border-radius: 8px;
  transition: background .15s ease;
}
.wie-side-item:hover { background: var(--surface); }
.wie-side-item.is-active { background: var(--accent-tint-08); }
.wie-side-item.is-sub { margin-left: 14px; }
.wie-side-label {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px 4px 9px 10px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Inter', sans-serif;
}
.wie-side-item.is-active .wie-side-label { color: var(--accent); font-weight: 600; }
.wie-side-item.is-sub .wie-side-label { font-size: 12.5px; color: var(--text-muted); }
.wie-side-rename {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  margin-right: 6px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease, background .15s ease;
}
.wie-side-item:hover .wie-side-rename,
.wie-side-item.is-active .wie-side-rename { opacity: 1; }
.wie-side-rename:hover { color: var(--accent); background: var(--surface); }
.wie-side-rename svg { width: 14px; height: 14px; }
.wie-side-input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 4px 6px;
  padding: 7px 9px;
  border-radius: 7px;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
}

@media (max-width: 780px) {
  .wie { flex-direction: column; height: auto; }
  .wie-side { flex-basis: auto; max-height: 220px; }
}

/* ── Fullscreen toggle (button lives at the top of the outline pane) ──
   position:fixed breaks out of any ancestor (modal or the wizard's inline
   mount) so the same toggle works in both contexts. */
.wie.wie-fullscreen {
  position: fixed;
  inset: 16px;
  z-index: 1100;
  background: var(--bg);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}

/* ══ Modal shell (knowledge page) ══ */
.wie-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: wieFade .2s ease both;
}
.wie-modal[hidden] { display: none; }
@keyframes wieFade { from { opacity: 0; } to { opacity: 1; } }
.wie-modal-card {
  width: 100%;
  max-width: 1040px;
  height: min(85vh, 780px);
  background: var(--bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.wie-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--glass-border);
}
.wie-modal-head h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px; font-weight: 700; color: var(--heading);
}
.wie-modal-close {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  font-size: 20px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.wie-modal-close:hover { color: var(--danger); border-color: var(--danger); }
.wie-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 22px;
  display: flex;
}

/* ══ In-modal generation progress ══ */
.wie-progress {
  margin: auto;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px;
}
.wie-progress-top {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--heading);
}
.wie-progress-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: wieBlink 1.2s ease-in-out infinite;
}
@keyframes wieBlink {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(96,165,250,.55); }
  55%      { opacity: .3; box-shadow: 0 0 0 7px rgba(96,165,250,0); }
}
.wie-progress-bar {
  align-self: stretch;
  height: 4px;
  border-radius: 999px;
  background: var(--glass-border);
  overflow: hidden;
  margin-bottom: 28px;
}
.wie-progress-fill {
  display: block;
  height: 100%;
  width: 10%;
  border-radius: inherit;
  background: var(--gradient-1);
  transition: width .55s var(--ease-standard);
}
.wie-progress-spinner {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent);
  animation: wieSpin .8s linear infinite;
  margin-bottom: 16px;
}
@keyframes wieSpin { to { transform: rotate(360deg); } }
.wie-progress-note { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ══ In-modal setup flow (URL prompt → page discovery → page selection) ══ */
.wie-setup {
  margin: auto;
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.wie-setup-center {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
}
.wie-setup-head { margin-bottom: 18px; }
.wie-setup-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 8px;
}
.wie-setup-desc { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; }
.wie-setup-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.wie-setup-input::placeholder { color: var(--text-muted); }
.wie-setup-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint-08, rgba(96,165,250,.12));
}
.wie-setup-error {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--danger);
  line-height: 1.5;
}
.wie-setup-error[hidden] { display: none; }
.wie-setup-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}
.wie-setup-spacer { flex: 1 1 auto; }
.wie-setup-back {
  margin-right: auto;
  background: none;
  border: none;
  padding: 6px 2px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s ease;
}
.wie-setup-back:hover { color: var(--accent); }
/* Unscoped .btn-create is bare in this codebase; supply the button chrome here. */
.wie-setup-primary {
  width: auto;
  padding: 11px 24px;
  border: none;
  border-radius: 10px;
  background: var(--gradient-1);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.wie-setup-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(96,165,250,.28); }
.wie-setup-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

/* Page-selection list */
.wie-route-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg, 14px);
  background: var(--bg-alt);
  padding: 8px;
}
.wie-route-list { display: flex; flex-direction: column; gap: 6px; }
.wie-route {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--glass);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.wie-route:hover { background: var(--surface); }
.wie-route.is-selected { border-color: var(--accent); background: var(--accent-tint-08, rgba(96,165,250,.1)); }
.wie-route input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.wie-route-path {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wie-route-del {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  color: var(--text-muted);
  font-size: 18px; line-height: 1;
  border-radius: 6px;
  transition: color .15s ease, background .15s ease;
}
.wie-route-del:hover { color: var(--danger); background: var(--surface); }
.wie-route-none { padding: 28px 16px; text-align: center; font-size: 13px; color: var(--text-muted); }
.wie-route-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.wie-route-add .wie-setup-input { flex: 1 1 auto; }
.wie-route-add-btn {
  flex: 0 0 auto;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.wie-route-add-btn:hover { border-color: var(--accent); color: var(--accent); }
.wie-route-count { font-size: 13px; color: var(--text-muted); }
.wie-route-count b { color: var(--text); font-weight: 700; }

/* ══ Knowledge-page "Website Info" card ══
   Preview/outline styling (.kw-wi-display, .kw-wi-text, .kw-wi-outline, ...)
   lives in project_knowledge.css alongside the rest of the page's layout. */
.kw-wi-preview { margin-bottom: 16px; }
.kw-wi-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.kw-wi-card-empty .kw-wi-actions {
  justify-content: center;
  margin-top: auto;
}
.kw-wi-actions [hidden] { display: none; }
/* Unscoped .btn-create is deliberately bare everywhere in this codebase — every
   context that uses it supplies its own chrome. This is that chrome for the
   Edit/Generate buttons on the Website Info card. */
.kw-wi-actions .btn-create {
  width: auto;
  padding: 10px 22px;
  border: none;
  border-radius: 10px;
  background: var(--gradient-1);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.kw-wi-actions .btn-create:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(96,165,250,.28);
}
.kw-wi-actions #kw-wi-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 11px 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, .22), transparent 24%),
    linear-gradient(135deg, #2563eb 0%, #4f46e5 42%, #d946ef 100%);
  box-shadow: 0 10px 28px rgba(37, 99, 235, .26), 0 0 18px rgba(217, 70, 239, .16);
}
.kw-wi-actions #kw-wi-generate[hidden] { display: none; }
.kw-wi-actions #kw-wi-generate:hover {
  box-shadow: 0 12px 30px rgba(37, 99, 235, .32), 0 0 22px rgba(217, 70, 239, .2);
}
.kw-wi-ai-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, .4));
}
