/* ============================================================
   AI Help Guides — Chat Widget Styles
   Self-contained (own CSS vars) so it looks consistent across
   every article's differing theme system.
   ============================================================ */

#aihg-chat-root {
  --aihg-accent: #e8d5a3;
  --aihg-accent-dark: #8b6914;
  --aihg-bg: #16161a;
  --aihg-bg2: #1e1e24;
  --aihg-text: #f2f0eb;
  --aihg-text2: #9a9a8e;
  --aihg-border: #2e2e2e;
  font-family: 'Instrument Sans', 'Outfit', system-ui, sans-serif;
}

#aihg-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--aihg-accent);
  border: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.2s ease;
}
#aihg-chat-fab:hover { transform: scale(1.08); }

#aihg-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: var(--aihg-bg);
  border: 1px solid var(--aihg-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}
#aihg-chat-panel.aihg-hidden { display: none; }

.aihg-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--aihg-border);
  background: var(--aihg-bg2);
}
.aihg-chat-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--aihg-text);
}
#aihg-chat-close {
  background: none;
  border: none;
  color: var(--aihg-text2);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
}
#aihg-chat-close:hover { color: var(--aihg-text); }

#aihg-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aihg-msg {
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 85%;
  white-space: pre-wrap;
  word-break: break-word;
}
.aihg-msg-bot {
  background: var(--aihg-bg2);
  color: var(--aihg-text);
  align-self: flex-start;
  border: 1px solid var(--aihg-border);
}
.aihg-msg-user {
  background: var(--aihg-accent);
  color: #1a1a1a;
  align-self: flex-end;
}

.aihg-typing { display: flex; gap: 4px; padding: 14px 16px; align-items: center; }
.aihg-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--aihg-text2);
  animation: aihg-bounce 1.2s infinite ease-in-out;
}
.aihg-typing span:nth-child(2) { animation-delay: 0.15s; }
.aihg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aihg-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

#aihg-chat-form {
  display: flex;
  border-top: 1px solid var(--aihg-border);
  background: var(--aihg-bg2);
}
#aihg-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--aihg-text);
  padding: 14px 16px;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
}
#aihg-chat-input::placeholder { color: var(--aihg-text2); }
#aihg-chat-send {
  border: none;
  background: transparent;
  color: var(--aihg-accent);
  font-size: 16px;
  padding: 0 16px;
  cursor: pointer;
}
#aihg-chat-send:hover { color: var(--aihg-accent-dark); }

@media (max-width: 480px) {
  #aihg-chat-panel {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 84px;
  }
  #aihg-chat-fab { right: 16px; bottom: 16px; }
}
