/* ──────────────────────────────────────────────────────────────────
 * hive-chat.css — live LLM chat panel, sitewide
 * Companion to /assets/hive-chat.js
 * Dark theme, 380×540 panel, floating bottom-right.
 * chat-bee occupies bottom-right; hive-chat button sits above it.
 * ────────────────────────────────────────────────────────────────── */

/* ── Trigger button ── */
#hive-chat-btn {
  position: fixed;
  right: 24px;
  bottom: 100px; /* sit above chat-bee if present, else still looks fine */
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #0A0D12;
  border: 1.5px solid rgba(41,179,126,.55);
  box-shadow: 0 0 0 1px rgba(41,179,126,.18), 0 8px 28px -8px rgba(0,0,0,.65);
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .22s cubic-bezier(.2,.7,.2,1.05), box-shadow .22s;
  outline: none;
}
#hive-chat-btn:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 0 0 1px rgba(41,179,126,.4), 0 12px 32px -6px rgba(0,0,0,.7);
}
#hive-chat-btn:focus-visible {
  outline: 2px solid #29B37E;
  outline-offset: 4px;
}

/* hexagon icon svg inside button */
#hive-chat-btn svg {
  display: block;
}

/* green pulse dot on button */
#hive-chat-btn .hc-pulse {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #29B37E;
  box-shadow: 0 0 6px 2px rgba(41,179,126,.6);
  animation: hc-pulse-ring 2.2s ease-out infinite;
}
@keyframes hc-pulse-ring {
  0%   { transform: scale(.9); opacity: 1; }
  60%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(.9); opacity: 0; }
}

/* ── Panel ── */
#hive-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 162px; /* button height + gap + chat-bee offset */
  width: 380px;
  height: 540px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 100px);
  background: #0D1118;
  border: 1px solid rgba(41,179,126,.28);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(41,179,126,.08),
    0 32px 80px -20px rgba(0,0,0,.82),
    inset 0 1px 0 rgba(255,255,255,.04);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .22s, transform .26s cubic-bezier(.2,.7,.2,1.05), visibility .22s;
}
#hive-chat-panel.hc-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ── Header ── */
.hc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(41,179,126,.15);
  background: rgba(10,13,18,.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-shrink: 0;
}
.hc-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hc-title {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #29B37E;
  line-height: 1;
}
.hc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #29B37E;
  box-shadow: 0 0 5px 1px rgba(41,179,126,.7);
  animation: hc-dot-blink 2.6s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes hc-dot-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: .45; }
}
.hc-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.hc-btn-icon {
  background: transparent;
  border: none;
  color: rgba(232,237,243,.5);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  line-height: 1;
  font-family: inherit;
}
.hc-btn-icon:hover {
  color: #E8EDF3;
  background: rgba(255,255,255,.06);
}
.hc-btn-icon[title="Close"] {
  font-size: 16px;
}

/* ── Messages ── */
.hc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.hc-messages::-webkit-scrollbar {
  width: 4px;
}
.hc-messages::-webkit-scrollbar-track {
  background: transparent;
}
.hc-messages::-webkit-scrollbar-thumb {
  background: rgba(41,179,126,.25);
  border-radius: 2px;
}

/* individual message */
.hc-msg {
  display: flex;
  flex-direction: column;
  max-width: 92%;
}
.hc-msg.hc-user {
  align-self: flex-end;
  align-items: flex-end;
}
.hc-msg.hc-assistant {
  align-self: flex-start;
  align-items: flex-start;
}
.hc-msg-bubble {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.hc-user .hc-msg-bubble {
  background: rgba(41,179,126,.15);
  border: 1px solid rgba(41,179,126,.25);
  color: #E8EDF3;
  border-bottom-right-radius: 4px;
}
.hc-assistant .hc-msg-bubble {
  background: rgba(26,34,44,.9);
  border: 1px solid rgba(255,255,255,.07);
  color: #D8E0E8;
  border-bottom-left-radius: 4px;
}
/* markdown link styling inside assistant messages */
.hc-assistant .hc-msg-bubble a {
  color: #29B37E;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hc-assistant .hc-msg-bubble a:hover {
  color: #45d49a;
}

/* typing cursor during streaming */
.hc-cursor {
  display: inline-block;
  width: 2px;
  height: 13px;
  background: #29B37E;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: hc-cursor-blink .8s step-end infinite;
}
@keyframes hc-cursor-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* system / error / rate-limit notices */
.hc-notice {
  align-self: center;
  background: rgba(201,90,90,.1);
  border: 1px solid rgba(201,90,90,.25);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: rgba(232,237,243,.7);
  text-align: center;
  max-width: 94%;
  line-height: 1.45;
}
.hc-notice.hc-notice--info {
  background: rgba(41,179,126,.07);
  border-color: rgba(41,179,126,.2);
}
.hc-notice.hc-notice--warn {
  background: rgba(235,166,40,.08);
  border-color: rgba(235,166,40,.25);
  color: rgba(232,237,243,.75);
}

/* welcome state */
.hc-welcome {
  align-self: center;
  text-align: center;
  color: rgba(232,237,243,.45);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 20px 16px;
}
.hc-welcome strong {
  color: rgba(232,237,243,.75);
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

/* ── Input area ── */
.hc-input-area {
  flex-shrink: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(41,179,126,.12);
  background: rgba(10,13,18,.6);
}
.hc-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.hc-input {
  flex: 1;
  resize: none;
  background: rgba(26,34,44,.95);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  color: #E8EDF3;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  padding: 8px 11px;
  outline: none;
  min-height: 38px;
  max-height: 110px;
  overflow-y: auto;
  transition: border-color .15s;
  scrollbar-width: thin;
}
.hc-input:focus {
  border-color: rgba(41,179,126,.45);
}
.hc-input::placeholder {
  color: rgba(232,237,243,.28);
}
.hc-send {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #29B37E;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
  align-self: flex-end;
}
.hc-send:hover:not(:disabled) {
  background: #32c98f;
  transform: scale(1.05);
}
.hc-send:disabled {
  background: rgba(41,179,126,.3);
  cursor: not-allowed;
}
.hc-send svg {
  display: block;
}

/* ── Footer ── */
.hc-footer {
  padding: 5px 14px 8px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .09em;
  color: rgba(232,237,243,.22);
  border-top: 1px solid rgba(255,255,255,.04);
  flex-shrink: 0;
  text-transform: uppercase;
}

/* ── Mobile ── */
@media (max-width: 540px) {
  #hive-chat-btn {
    right: 16px;
    bottom: 92px;
  }
  #hive-chat-panel {
    right: 8px;
    bottom: 152px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 100px);
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  #hive-chat-panel {
    transition: opacity .15s, visibility .15s;
    transform: none;
  }
  #hive-chat-panel.hc-open {
    transform: none;
  }
  .hc-pulse,
  .hc-dot,
  .hc-cursor {
    animation: none;
  }
}

/* ── Suggestion chips (deterministic backend follow-ups) ── */
.hc-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 0 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.hc-chip {
  appearance: none;
  background: rgba(180,115,18, 0.08);
  color: #E8DDC2;
  border: 1px solid rgba(180,115,18, 0.35);
  border-radius: 999px;
  padding: 5px 11px;
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.hc-chip:hover,
.hc-chip:focus-visible {
  background: rgba(180,115,18, 0.16);
  border-color: rgba(180,115,18, 0.6);
  outline: none;
}
.hc-typing .hc-msg-bubble {
  min-height: 18px;
}
