/* ============================================================
   Chat Widget Styles — never changes between clients
   Color is controlled by --chat-color CSS variable,
   set automatically from bot-config.js
   ============================================================ */

:root {
  --chat-color: #7c3aed; /* fallback — overridden by bot-config.js */
  --chat-radius: 16px;
  --chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

#chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--chat-color);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--chat-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s;
}

#chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

#chat-bubble svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

#chat-window {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
}

#chat-window.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

#chat-header {
  background: var(--chat-color);
  color: #fff;
  padding: 14px 18px;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#chat-header span {
  display: flex;
  align-items: center;
  gap: 8px;
}

#chat-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

#chat-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  opacity: 0.8;
}

#chat-close:hover {
  opacity: 1;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: system-ui, sans-serif;
  font-size: 14px;
}

.chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg a {
  color: var(--chat-color);
  text-decoration: underline;
}

.chat-msg.bot {
  background: #f1f5f9;
  color: #1e293b;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  background: var(--chat-color);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.typing {
  background: #f1f5f9;
  align-self: flex-start;
  color: #94a3b8;
  font-style: italic;
}

#chat-input-row {
  display: flex;
  border-top: 1px solid #e2e8f0;
  padding: 10px 12px;
  gap: 8px;
  background: #fff;
}

#chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: system-ui, sans-serif;
  outline: none;
  resize: none;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
}

#chat-input:focus {
  border-color: var(--chat-color);
}

#chat-send {
  background: var(--chat-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.15s;
  white-space: nowrap;
}

#chat-send:hover {
  opacity: 0.88;
}

#chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile */
@media (max-width: 420px) {
  #chat-window {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 70vh;
    border-radius: var(--chat-radius) var(--chat-radius) 0 0;
  }
  #chat-bubble {
    bottom: 20px;
    right: 20px;
  }
}
