/* Get Connected wizard. Loaded only on its page, on top of site.css, whose colours,
   panels and buttons it reuses. The class names here are the ones wizard.js creates. */

/* ---- layout: the page head, then a chat pane beside a progress rail */
.wizard-head { padding-block: 1.1rem .8rem; }
.wizard-head h1 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); letter-spacing: -.025em; line-height: 1.1; }
.wizard-head p { margin-top: .4rem; color: #d3dceb; font-size: .95rem; }
.wizard-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 17.5rem; gap: 1rem;
  height: clamp(32rem, calc(100dvh - 12.5rem), 60rem);
}
.wizard-pane { position: relative; display: flex; flex-direction: column; overflow: hidden; min-width: 0; min-height: 0; }
.rail-pane { min-height: 0; display: flex; flex-direction: column; gap: .8rem; }

/* ---- assistant header */
.assistant-head {
  flex: none; display: flex; align-items: center; gap: .8rem;
  padding: .8rem 7.5rem .8rem 1.1rem; border-bottom: 1px solid var(--line);
}
.assistant-head strong { font-size: 1.05rem; font-weight: 650; }
.ready-indicator { display: inline-flex; align-items: center; gap: .4rem; color: var(--online); font-size: .82rem; white-space: nowrap; }
.ready-indicator .status-label { display: inline; margin: 0; }
.status-dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--online); display: inline-block; }
.status-dot.ready { animation: statusPulse 2.4s ease-in-out infinite; }
.status-dot.checking { animation: statusPulse 1.4s ease-in-out infinite; }
.assistant-status { font-size: .76rem; color: var(--muted); }

/* ---- conversation */
.transcript {
  flex: 1; min-height: 0; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .6rem;
  overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable;
}
.msg { flex: none; max-width: 92%; padding: .65rem .9rem; border-radius: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.assistant { align-self: flex-start; background: rgba(148, 178, 214, .1); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.system { align-self: flex-start; font-size: .85rem; color: var(--muted); border: 1px dashed var(--line-strong); }
.msg.registered-success { color: var(--online); background: rgba(74, 222, 128, .1); border-color: rgba(74, 222, 128, .4); }
.msg.registered-success::before { content: "✓ "; font-weight: 700; }
.msg.registration-warning { color: var(--amber); background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .35); }
.msg.registration-warning::before { content: "⚠ "; }
.msg.registration-unknown { color: #cbd5e1; background: rgba(148, 178, 214, .08); border-color: var(--line-strong); }
.typing-dots { display: inline-flex; align-items: center; gap: 4px; padding: 3px 0; }
.typing-dots span { width: 5px; height: 5px; background: var(--muted); border-radius: 50%; animation: typingBounce 1.4s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }

/* ---- answer area */
.response-zone { flex: none; border-top: 1px solid var(--line); padding: .8rem 1.1rem; background: rgba(7, 11, 20, .55); }
.composer-row { display: flex; align-items: center; gap: .5rem; }
.composer-row label { font-size: .88rem; color: var(--muted); white-space: nowrap; }
.composer-row input {
  flex: 1; min-width: 0; height: 2.6rem; padding: 0 .8rem; font: inherit; color: var(--text);
  background: rgba(148, 178, 214, .08); border: 1px solid var(--line-strong); border-radius: 10px;
}
.composer-row input::placeholder { color: #6b7a90; }
.composer-results { display: flex; flex-wrap: wrap; gap: .5rem; max-height: min(11rem, 24dvh); overflow-y: auto; margin-top: .6rem; overscroll-behavior-y: contain; }
.composer-results:empty { display: none; }
.composer-results:not(:empty)::before { content: "Suggestions"; flex: 0 0 100%; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.composer-result-item {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 2px; max-width: 100%;
  padding: .5rem .85rem; border: 1px solid var(--line-strong); border-radius: 10px;
  background: rgba(148, 178, 214, .08); cursor: pointer; font-size: .9rem; overflow-wrap: anywhere;
}
.composer-result-item:hover { border-color: var(--accent); background: rgba(56, 189, 248, .12); }
.item-id { color: var(--muted); font: .65rem var(--mono); }
.sr-type { display: inline-block; border-radius: 999px; padding: 1px 6px; margin-left: 4px; font-size: .62rem; text-transform: uppercase; border: 1px solid currentColor; }
.badge-info { color: #7dd3fc; } .badge-warn { color: var(--amber); } .badge-ok { color: var(--online); }
.action-area:empty { display: none; }
.choice-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice-btn, .report-btn, .back-btn {
  height: 2.4rem; padding: 0 1rem; border-radius: 999px; cursor: pointer;
  font: 600 .88rem/1 inherit; color: var(--text);
  background: rgba(56, 189, 248, .1); border: 1px solid rgba(56, 189, 248, .35);
}
.choice-btn:hover, .report-btn:hover, .back-btn:hover { background: rgba(56, 189, 248, .2); border-color: var(--accent); }
.wizard-pane button:disabled { opacity: .45; cursor: not-allowed; }
.response-zone:has(.action-area .choice-buttons) .composer-row { display: none; }
.response-zone:has(.action-area:not(:empty)) .composer-results:empty { margin: 0; }

/* ---- print / PDF / start over: a quiet "Start over" until there is a report */
.bottom-action-bar { flex: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); background: rgba(7, 11, 20, .55); }
.report-bottom-bar { display: none; }
.wizard-pane:not(:has(.report)) .bottom-action-bar { position: absolute; top: .65rem; right: .8rem; padding: 0; border: 0; background: none; }
.wizard-pane:not(:has(.report)) #barPrint, .wizard-pane:not(:has(.report)) #barPdf { display: none; }
.wizard-pane:not(:has(.report)) #barRestart { height: 1.9rem; font-size: .76rem; color: var(--muted); }
.wizard-pane:has(.report) .response-zone { display: none; }

/* ---- progress rail */
.rail-card { flex: none; padding: .85rem 1.1rem; }
/* the last card stretches so the column ends level with the Assistant, counter at the bottom */
.rail-card:last-child { flex: 1; display: flex; flex-direction: column; }
.rail-card:last-child .report-count { margin-top: auto; }
.rail-card h2 { margin-bottom: .45rem; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.step-chips { display: flex; flex-direction: column; }
.progress-step { display: flex; align-items: center; gap: .7rem; padding: .22rem 0; font-size: .88rem; color: var(--muted); }
.step-num { flex: 0 0 1.55rem; height: 1.55rem; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font: 600 .76rem var(--mono); }
.progress-step.active, .progress-step.done { color: var(--text); }
.progress-step.active .step-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 10px rgba(56, 189, 248, .45); }
.progress-step.done .step-num { color: transparent; background: rgba(74, 222, 128, .12); border-color: rgba(74, 222, 128, .45); position: relative; }
.progress-step.done .step-num::after { content: "✓"; color: var(--online); position: absolute; }
.progress-step.blocked { color: var(--amber); }
.rail-body { color: var(--muted); font-size: .88rem; }
.support-help { margin-top: .6rem; width: 100%; }
.report-count { margin-top: .7rem; padding-top: .6rem; border-top: 1px solid var(--line); color: var(--accent); font-size: .82rem; font-weight: 600; text-align: right; }

/* ---- the finished report, shown in the conversation */
.report { flex: none; min-width: 0; padding: 1.1rem 1.1rem 1.6rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(148, 178, 214, .07); overflow-wrap: anywhere; }
.report-title { font-size: 1.1rem; font-weight: 700; margin: .7rem 0; }
.report-status-banner { padding: .5rem .8rem; border-left: 3px solid var(--online); border-radius: 6px; background: rgba(74, 222, 128, .1); color: var(--online); font-size: .86rem; font-weight: 700; }
.report-recap-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .9rem; }
.report-recap-table td { padding: .45rem .5rem; border-top: 0; border-bottom: 1px solid var(--line); }
.recap-label { width: 28%; color: var(--muted); font-size: .72rem; text-transform: uppercase; font-weight: 600; }
.report-section { margin: 1.2rem 0; }
.report-section h3 { color: var(--accent); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); padding-bottom: .5rem; margin-bottom: .5rem; }
.report-section p, .report-section li { font-size: .95rem; line-height: 1.65; }
.report-section ol { list-style: decimal; padding-left: 1.5rem; }
.report-section ul { list-style: disc; padding-left: 1.5rem; }
.report-section li { margin: .35rem 0; }
.report-warnings-list { color: var(--amber); }
.report-link-commands { font-family: var(--mono); }
.transcript, .rail-pane, .composer-results { scrollbar-width: thin; scrollbar-color: #475569 transparent; }
.print-report { display: none; }

/* ---- welcome and walkthrough windows */
.wizard-dialog { width: min(40rem, 100% - 2rem); padding: 1.6rem 1.7rem; text-align: center; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--panel-solid); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.wizard-dialog::backdrop { background: rgba(4, 7, 13, .75); backdrop-filter: blur(3px); }
.wizard-dialog h2 { font-size: 1.4rem; margin-bottom: .8rem; }
.wizard-dialog p { color: #d3dceb; margin-bottom: 1.2rem; }
.wizard-dialog.video { width: min(64rem, 100% - 2rem); text-align: left; border-color: var(--line-strong); }
.wizard-dialog.video header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.wizard-dialog.video h2 { margin: 0; font-size: 1.15rem; }
.wizard-dialog video { display: block; width: 100%; height: auto; max-height: calc(100dvh - 12rem); border-radius: 8px; background: #000; }
.wizard-dialog.video p { margin: .7rem 0 0; font-size: .86rem; color: var(--muted); }

@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }

@media screen and (max-width: 900px) {
  .wizard-grid { grid-template-columns: 1fr; height: auto; }
  .wizard-pane { height: 36rem; }
}
@media screen and (max-width: 540px) {
  .assistant-head { padding-left: .8rem; padding-right: 6rem; gap: .5rem; }
  .transcript, .response-zone { padding: .75rem; }
  .msg { max-width: 96%; font-size: .94rem; }
  .composer-row label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .recap-label { width: 42%; }
  .bottom-action-bar .btn { flex: 1; padding: 0 .5rem; font-size: .76rem; }
}
@media (prefers-reduced-motion: reduce) { .status-dot, .typing-dots span { animation: none; } }

/* ---- printing: only the report, as a clean black-on-white page */
@media print {
  @page { size: letter; margin: .5in .6in; }
  body { display: block; color: #222; background: #fff !important; min-height: 0; font: 10pt/1.5 system-ui, sans-serif; }
  .backdrop, .skip, .site-header, .site-footer, .whatsnew, dialog, main > :not(#printReport) { display: none !important; }
  #printReport, #printReport[hidden] { display: block !important; }
  #printReport h1 { font-size: 20pt; margin: 0 0 4pt; }
  #printReport h2 { font-size: 12pt; margin: 16pt 0 6pt; border-bottom: 1px solid #ccd2d9; padding-bottom: 4pt; break-after: avoid; }
  #printReport p { margin: 6pt 0; orphans: 3; widows: 3; }
  #printReport table { border-collapse: collapse; width: 100%; table-layout: fixed; margin: 12pt 0; font-size: 10pt; }
  #printReport td { padding: 5pt 7pt; border-top: 0; border-bottom: 1px solid #ddd; overflow-wrap: anywhere; }
  #printReport .recap-label { width: 28%; font-weight: 600; color: #485466; }
  #printReport .print-subtitle { color: #596575; }
  #printReport .print-status { padding: 7pt 10pt; margin-top: 10pt; background: #eff7f1; border-left: 3pt solid #2e7d32; font-weight: 700; }
  #printReport ol { list-style: decimal; padding-left: 22pt; }
  #printReport ul { list-style: disc; padding-left: 22pt; }
  #printReport li { margin: 5pt 0; break-inside: avoid; }
  #printReport tr { break-inside: avoid; }
  #printReport .print-link-commands { font-family: ui-monospace, Consolas, monospace; }
  #printReport .print-footer { border-top: 1px solid #ddd; margin-top: 16pt; padding-top: 8pt; font-size: 8pt; color: #667; }
  #printReport button { display: none !important; }
}
