/* Hat Creek Power Assistant — embeddable chat widget
   Brand: deep navy #0D1F40, antique gold #C5A04A, white.
   Sharp rectangular industrial styling. No gradients. Lucide icons only. */

:root {
  --hc-navy: #0d1f40;
  --hc-navy-800: #12264d;
  --hc-navy-700: #1a3160;
  --hc-navy-600: #24406f;
  --hc-gold: #c5a04a;
  --hc-gold-dark: #a9863a;
  --hc-white: #ffffff;
  --hc-ink: #0f1725;
  --hc-line: rgba(197, 160, 74, 0.28);
  --hc-line-soft: rgba(255, 255, 255, 0.12);
  --hc-muted: #b7c2d6;
  --hc-panel-bg: #0f2244;
  --hc-surface: #14294f;
  --hc-danger: #e06c5a;
  --hc-radius: 2px;
  --hc-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --hc-font-head: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --hc-font-body: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --hc-launch-size: 60px;
  --hc-offset: 24px;
}

/* Scope everything under #hc-widget so we don't collide with host CSS */
#hc-widget,
#hc-widget * {
  box-sizing: border-box;
}
#hc-widget {
  position: fixed;
  right: var(--hc-offset);
  bottom: var(--hc-offset);
  z-index: 2147483000;
  font-family: var(--hc-font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--hc-white);
  -webkit-font-smoothing: antialiased;
}

/* When embedded as a full-page app (demo/iframe target), fill the frame */
#hc-widget.hc-embedded {
  position: fixed;
  inset: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}

/* ---------- Launcher ---------- */
.hc-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: var(--hc-launch-size);
  padding: 0 20px 0 18px;
  background: var(--hc-gold);
  color: var(--hc-navy);
  border: none;
  border-radius: var(--hc-radius);
  cursor: pointer;
  font-family: var(--hc-font-head);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--hc-shadow);
  transition: background 0.15s ease, transform 0.15s ease;
}
.hc-launcher:hover {
  background: var(--hc-gold-dark);
}
.hc-launcher:active {
  transform: translateY(1px);
}
.hc-launcher svg {
  width: 24px;
  height: 24px;
  flex: none;
}
.hc-launcher .hc-launch-label {
  white-space: nowrap;
}
#hc-widget.hc-open .hc-launcher {
  display: none;
}

/* ---------- Panel ---------- */
.hc-panel {
  display: none;
  flex-direction: column;
  width: 390px;
  max-width: calc(100vw - 2 * var(--hc-offset));
  height: 620px;
  max-height: calc(100vh - 2 * var(--hc-offset));
  background: var(--hc-panel-bg);
  border: 1px solid var(--hc-line);
  border-radius: var(--hc-radius);
  box-shadow: var(--hc-shadow);
  overflow: hidden;
}
#hc-widget.hc-open .hc-panel {
  display: flex;
}
#hc-widget.hc-embedded .hc-panel {
  display: flex;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

/* ---------- Header ---------- */
.hc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--hc-navy);
  border-bottom: 2px solid var(--hc-gold);
  flex: none;
}
.hc-header .hc-logo {
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--hc-gold);
}
.hc-header-text {
  flex: 1;
  min-width: 0;
}
.hc-title {
  font-family: var(--hc-font-head);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.05;
  color: var(--hc-white);
}
.hc-subtitle {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hc-gold);
  margin-top: 2px;
}
.hc-header-actions {
  display: flex;
  gap: 4px;
}
.hc-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--hc-muted);
  border: 1px solid transparent;
  border-radius: var(--hc-radius);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.hc-iconbtn:hover {
  color: var(--hc-white);
  background: var(--hc-navy-700);
}
.hc-iconbtn svg {
  width: 20px;
  height: 20px;
}

/* ---------- Progress rail ---------- */
.hc-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--hc-navy-800);
  border-bottom: 1px solid var(--hc-line-soft);
  flex: none;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--hc-muted);
}
.hc-rail .hc-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--hc-line);
  color: var(--hc-gold);
  padding: 3px 8px;
  border-radius: var(--hc-radius);
  cursor: pointer;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hc-rail .hc-back:hover {
  background: var(--hc-navy-700);
}
.hc-rail .hc-back svg {
  width: 14px;
  height: 14px;
}
.hc-rail .hc-back[hidden] {
  display: none;
}
.hc-rail-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Message log ---------- */
.hc-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--hc-gold) transparent;
}
.hc-log::-webkit-scrollbar {
  width: 8px;
}
.hc-log::-webkit-scrollbar-thumb {
  background: var(--hc-navy-600);
  border-radius: 0;
}

.hc-msg {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: var(--hc-radius);
  font-size: 14.5px;
  animation: hc-rise 0.22s ease both;
}
@keyframes hc-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .hc-msg, #hc-widget * { animation: none !important; transition: none !important; }
}
.hc-msg.hc-bot {
  align-self: flex-start;
  background: var(--hc-surface);
  border: 1px solid var(--hc-line-soft);
  border-left: 3px solid var(--hc-gold);
}
.hc-msg.hc-user {
  align-self: flex-end;
  background: var(--hc-gold);
  color: var(--hc-navy);
  font-weight: 500;
}
.hc-msg strong { color: var(--hc-white); }
.hc-msg.hc-user strong { color: var(--hc-navy); }
.hc-msg p { margin: 0 0 8px; }
.hc-msg p:last-child { margin-bottom: 0; }
.hc-msg ul { margin: 6px 0 0; padding-left: 18px; }
.hc-msg li { margin-bottom: 3px; }

/* Result / summary card */
.hc-card {
  align-self: stretch;
  max-width: 100%;
  background: var(--hc-navy-800);
  border: 1px solid var(--hc-line);
  border-radius: var(--hc-radius);
  padding: 14px;
  animation: hc-rise 0.22s ease both;
}
.hc-card h3 {
  margin: 0 0 4px;
  font-family: var(--hc-font-head);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--hc-gold);
}
.hc-card .hc-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hc-muted);
  margin-bottom: 10px;
}
.hc-figure {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--hc-line-soft);
}
.hc-figure:first-of-type { border-top: none; }
.hc-figure .hc-fig-label {
  flex: 1;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--hc-muted);
}
.hc-figure .hc-fig-value {
  font-family: var(--hc-font-head);
  font-size: 20px;
  font-weight: 600;
  color: var(--hc-white);
  letter-spacing: 0.02em;
}
.hc-figure .hc-fig-value.hc-hero {
  color: var(--hc-gold);
  font-size: 24px;
}
.hc-kv {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  font-size: 13.5px;
  border-top: 1px solid var(--hc-line-soft);
}
.hc-kv:first-child { border-top: none; }
.hc-kv .hc-k {
  flex: 0 0 42%;
  color: var(--hc-muted);
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  padding-top: 2px;
}
.hc-kv .hc-v { flex: 1; color: var(--hc-white); word-break: break-word; }
.hc-note {
  margin-top: 10px;
  padding: 9px 11px;
  background: var(--hc-navy-700);
  border: 1px solid var(--hc-line-soft);
  border-radius: var(--hc-radius);
  font-size: 12.5px;
  color: var(--hc-muted);
}
.hc-note .hc-note-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--hc-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
  margin-bottom: 4px;
}
.hc-note svg { width: 15px; height: 15px; flex: none; }
.hc-card-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--hc-muted); }
.hc-card-list li { margin-bottom: 4px; }

/* ---------- Interaction dock ---------- */
.hc-dock {
  flex: none;
  padding: 12px 16px 14px;
  background: var(--hc-navy);
  border-top: 1px solid var(--hc-line);
  max-height: 46%;
  overflow-y: auto;
}
.hc-prompt {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hc-gold);
  margin-bottom: 8px;
}
.hc-choices {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.hc-choices.hc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.hc-choice {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 13px;
  background: var(--hc-surface);
  color: var(--hc-white);
  border: 1px solid var(--hc-line);
  border-radius: var(--hc-radius);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease;
  min-height: 44px;
}
.hc-choice:hover {
  background: var(--hc-navy-600);
  border-color: var(--hc-gold);
}
.hc-choice.hc-selected {
  background: var(--hc-gold);
  color: var(--hc-navy);
  border-color: var(--hc-gold);
  font-weight: 600;
}
.hc-choice svg { width: 18px; height: 18px; flex: none; color: var(--hc-gold); }
.hc-choice.hc-selected svg { color: var(--hc-navy); }

/* Form fields */
.hc-field { margin-bottom: 10px; }
.hc-field label {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hc-muted);
  margin-bottom: 4px;
}
.hc-field .hc-req { color: var(--hc-gold); }
.hc-input,
.hc-select,
.hc-textarea {
  width: 100%;
  padding: 10px 11px;
  background: var(--hc-panel-bg);
  color: var(--hc-white);
  border: 1px solid var(--hc-line);
  border-radius: var(--hc-radius);
  font: inherit;
  font-size: 14px;
}
.hc-textarea { resize: vertical; min-height: 64px; }
.hc-input::placeholder, .hc-textarea::placeholder { color: #6f83a6; }
.hc-select option { color: #000; }
.hc-hint {
  font-size: 11.5px;
  color: var(--hc-muted);
  margin-top: 4px;
}
.hc-error {
  font-size: 11.5px;
  color: var(--hc-danger);
  margin-top: 4px;
}
.hc-field-error .hc-input,
.hc-field-error .hc-select { border-color: var(--hc-danger); }

.hc-row { display: flex; gap: 8px; }
.hc-row > * { flex: 1; }

/* Consent checkboxes */
.hc-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 11px;
  margin-bottom: 8px;
  background: var(--hc-panel-bg);
  border: 1px solid var(--hc-line);
  border-radius: var(--hc-radius);
  cursor: pointer;
}
.hc-consent input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  background: var(--hc-navy-800);
  border: 1.5px solid var(--hc-gold);
  border-radius: var(--hc-radius);
  cursor: pointer;
  position: relative;
}
.hc-consent input[type="checkbox"]:checked {
  background: var(--hc-gold);
}
.hc-consent input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid var(--hc-navy);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.hc-consent .hc-consent-text {
  font-size: 13px;
  color: var(--hc-white);
  line-height: 1.4;
}
.hc-consent .hc-consent-text .hc-req { color: var(--hc-gold); }
.hc-consent .hc-consent-sub {
  display: block;
  font-size: 11.5px;
  color: var(--hc-muted);
  margin-top: 2px;
}
.hc-field-error.hc-consent { border-color: var(--hc-danger); }

/* Buttons */
.hc-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 4px;
}
.hc-actions.hc-inline { flex-direction: row; }
.hc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--hc-radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--hc-font-head);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  min-height: 44px;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  text-decoration: none;
}
.hc-btn svg { width: 17px; height: 17px; }
.hc-btn-primary { background: var(--hc-gold); color: var(--hc-navy); }
.hc-btn-primary:hover { background: var(--hc-gold-dark); }
.hc-btn-secondary {
  background: transparent;
  color: var(--hc-white);
  border-color: var(--hc-line);
}
.hc-btn-secondary:hover { background: var(--hc-navy-700); border-color: var(--hc-gold); }
.hc-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hc-btn.hc-flex1 { flex: 1; }

/* Focus visibility — strong states */
#hc-widget :focus-visible {
  outline: 3px solid var(--hc-gold);
  outline-offset: 2px;
}
.hc-choice:focus-visible,
.hc-btn-primary:focus-visible { outline-color: var(--hc-white); }

/* Copy feedback */
.hc-copied {
  font-size: 12px;
  color: var(--hc-gold);
  margin-top: 6px;
  display: none;
  align-items: center;
  gap: 5px;
}
.hc-copied.hc-show { display: flex; }
.hc-copied svg { width: 14px; height: 14px; }

/* Footer strip */
.hc-footstrip {
  font-size: 10.5px;
  color: var(--hc-muted);
  text-align: center;
  padding: 6px 10px;
  background: var(--hc-navy);
  border-top: 1px solid var(--hc-line-soft);
  letter-spacing: 0.03em;
}

/* Mobile: full-screen sheet */
@media (max-width: 480px) {
  #hc-widget:not(.hc-embedded) {
    right: 12px;
    bottom: 12px;
  }
  #hc-widget.hc-open:not(.hc-embedded) {
    right: 0;
    bottom: 0;
    left: 0;
    top: 0;
  }
  #hc-widget.hc-open:not(.hc-embedded) .hc-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border: none;
    border-radius: 0;
  }
  .hc-launcher .hc-launch-label { display: none; }
  .hc-launcher { padding: 0; width: var(--hc-launch-size); justify-content: center; }
}
