/* ---------- Chat Widget ---------- */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient);
  color: var(--bg);
  border: none;
  cursor: pointer;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
  z-index: 1000;
  transition: transform 0.2s ease;
}
.chat-toggle:hover { transform: scale(1.06); }

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

.chat-header {
  padding: 14px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
.chat-header span.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 8px;
}
.chat-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--gradient);
  color: var(--bg);
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
}
.chat-msg.typing { opacity: 0.6; font-style: italic; }

.chat-input-row {
  display: flex;
  border-top: 1px solid var(--border);
  padding: 10px;
  gap: 8px;
}
.chat-input-row input {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}
.chat-input-row input:focus { outline: 1px solid var(--gold); }
.chat-input-row button {
  background: var(--gradient);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
}
.chat-input-row button:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 480px) {
  .chat-panel { right: 16px; left: 16px; width: auto; }
  .chat-toggle { right: 16px; }
}
