/* Widget de chat con IA — reutiliza las variables de color de index.html
   (--surface, --ink, --accent, etc.) para heredar tema claro/oscuro solo. */

.chat-toggle {
  position: fixed; right: 20px; bottom: 88px; z-index: 40;
  width: 52px; height: 52px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 50%; cursor: pointer;
  box-shadow: var(--shadow-lg);
}
.chat-toggle svg { width: 22px; height: 22px; }
.chat-toggle .icon-close { display: none; }
.chat-toggle.open .icon-chat { display: none; }
.chat-toggle.open .icon-close { display: block; }
@media (max-width: 620px) { .chat-toggle { right: 16px; bottom: 76px; width: 46px; height: 46px; } }

.chat-panel {
  position: fixed; right: 20px; bottom: 150px; z-index: 40;
  width: 340px; max-width: calc(100vw - 32px);
  height: 460px; max-height: calc(100vh - 200px);
  display: none;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chat-panel.open { display: flex; }
@media (max-width: 620px) { .chat-panel { right: 16px; bottom: 130px; } }

.chat-header {
  padding: 14px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 13.5px; font-weight: 700;
  color: var(--ink);
}
.chat-header span { display: block; font-weight: 500; font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}

.chat-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px; line-height: 1.45;
  white-space: pre-wrap; word-wrap: break-word;
}
.chat-msg.bot {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
}
.chat-msg.typing { color: var(--ink-faint); font-style: italic; }

.chat-whatsapp-cta {
  display: inline-flex; align-self: flex-start;
  background: #1ea952; color: #fff;
  border: none; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.chat-whatsapp-cta:hover { background: #189146; }

.chat-form {
  display: flex; gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.chat-input {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  background: var(--bg);
  color: var(--ink);
}
.chat-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.chat-send {
  width: 36px; height: 36px; flex: none;
  border: none; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.chat-send:disabled { opacity: .5; cursor: default; }
.chat-send svg { width: 16px; height: 16px; }
