/* ── Chat Widget Styles ─────────────────────────────────── */
#chat-widget-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(90deg, #111827 0%, #374151 100%);
  color: #fff;
  border: none;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  z-index: 9999;
  transition: transform .15s;
}
#chat-widget-btn:hover { transform: scale(1.08); }

#chat-widget-panel {
  display: none;
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 480px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  border: 1px solid #e5e7eb;
  z-index: 9999;
  flex-direction: column;
  overflow: hidden;
  font-family: system-ui, sans-serif;
}
#chat-widget-panel.open { display: flex; }

#chat-widget-header {
  background: linear-gradient(90deg, #111827 0%, #374151 100%);
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#chat-widget-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: color .15s;
}
#chat-widget-close:hover { color: #fff; }

#chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
}
#chat-widget-messages::-webkit-scrollbar { width: 4px; }
#chat-widget-messages::-webkit-scrollbar-track { background: #f9fafb; }
#chat-widget-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

.chat-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.chat-msg.user {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg.bot {
  background: #f9fafb;
  color: #111827;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid #e5e7eb;
}
.chat-msg.typing { color: #9ca3af; font-style: italic; }

/* Markdown rendering inside bot bubbles */
.chat-msg.bot strong { color: #111827; font-weight: 700; }
.chat-msg.bot em { font-style: italic; }
.chat-msg.bot code {
  background: #e5e7eb; border-radius: 3px;
  padding: 1px 5px; font-family: monospace; font-size: 12px;
}
.chat-msg.bot ul, .chat-msg.bot ol {
  margin: 6px 0 6px 18px; padding: 0;
}
.chat-msg.bot li { margin-bottom: 4px; }

#chat-widget-input-row {
  display: flex;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  gap: 8px;
  background: #f9fafb;
}
#chat-widget-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  background: #ffffff;
  color: #111827;
}
#chat-widget-input::placeholder { color: #9ca3af; }
#chat-widget-input:focus { border-color: #0ea5e9; }
#chat-widget-send {
  background: linear-gradient(90deg, #111827 0%, #374151 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .15s;
}
#chat-widget-send:hover { opacity: .85; }
#chat-widget-send:disabled { opacity: .4; cursor: default; }
