/* ==========================================================================
   chatbot.css — Asistente GECOTEL (botón flotante + panel)
   Alineado al sistema gc-*: ámbar #ffc107, tinta #1f2431, radios y sombras.
   Se conservan los nombres de clase/ID que usa chatbot.js.
   ========================================================================== */
:root {
  --cb-gold: #ffc107;
  --cb-gold-hi: #e0a800;
  --cb-ink: #1f2431;
  --cb-ease: cubic-bezier(.4, 0, .2, 1);
}

/* -------------------------------------------------------------- Panel ----- */
.chatbot-container {
  position: fixed;
  bottom: 92px;
  left: 24px;
  width: 340px;
  max-height: 520px;
  background: #fff;
  border: 1px solid #ece9e2;
  border-radius: 20px;
  box-shadow: 0 28px 70px -24px rgba(15, 23, 42, .42);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: 'Inter', system-ui, sans-serif;
  transition: width .3s var(--cb-ease), max-height .3s var(--cb-ease);
}
/* Estado expandido (botón de la cabecera) */
.chatbot-container.expanded { width: 420px; max-height: min(680px, 82vh); }
@media (min-width: 992px) { .chatbot-container.expanded { width: 460px; } }
.chatbot-container.open {
  display: flex;
  animation: cbPanelIn .3s var(--cb-ease);
  transform-origin: bottom left;
}
@keyframes cbPanelIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- Header ----- */
.chatbot-header {
  background: var(--cb-ink);
  color: #fff;
  padding: 13px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 800;
  font-size: .98rem;
}
/* Punto "en línea" antes del título */
.chatbot-header span { display: grid; grid-template-columns: 30px auto; grid-template-rows: 16px 12px; column-gap: .55rem; align-items: center; }
.chatbot-header span::before {
  content: none;
}
.chatbot-header span > i { grid-row: 1 / 3; width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--cb-gold); color: var(--cb-ink); font-size: .8rem; }
.chatbot-header span > b { font-size: .85rem; line-height: 1; }
.chatbot-header span > small { color: #b7c1d0; font-family: 'Inter', system-ui, sans-serif; font-size: .65rem; font-weight: 500; line-height: 1; }
@keyframes cbOnline {
  0%   { box-shadow: 0 0 0 0 rgba(31, 143, 78, .6); }
  70%  { box-shadow: 0 0 0 6px rgba(31, 143, 78, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 143, 78, 0); }
}
/* Acciones de la cabecera (FAQ · expandir · cerrar) */
.chatbot-actions { display: flex; align-items: center; gap: .35rem; }
.chatbot-action {
  background: rgba(255, 255, 255, .1);
  border: none;
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s var(--cb-ease), transform .2s var(--cb-ease);
}
.chatbot-action:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.chatbot-close { font-size: 18px; }
.chatbot-close:hover { transform: rotate(90deg); }

/* ----------------------------------------------------------- Mensajes ----- */
.chatbot-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  font-size: .92rem;
  line-height: 1.5;
  scroll-behavior: smooth;
  background: linear-gradient(180deg, #faf9f6 0%, #fff 100%);
}
.chatbot-messages div.user,
.chatbot-messages div.bot { display: flex; }
.chatbot-messages .user { justify-content: flex-end; }
.chatbot-messages .bot { justify-content: flex-start; }
.chatbot-messages .message-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  margin-bottom: 10px;
  max-width: 82%;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  animation: cbBubbleIn .25s var(--cb-ease);
}
@keyframes cbBubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.chatbot-messages .user .message-bubble {
  background: var(--cb-gold);
  color: var(--cb-ink);
  border-bottom-right-radius: 5px;
}
.chatbot-messages .bot .message-bubble {
  background: #fff;
  color: #2c3242;
  border: 1px solid #ece9e2;
  border-bottom-left-radius: 5px;
}

/* ------------------------------------------------------------- Input ------ */
.chatbot-input {
  display: flex;
  align-items: center;
  gap: .4rem;
  border-top: 1px solid #ece9e2;
  background: #fff;
  padding: .6rem .7rem;
}
.chatbot-input input {
  flex: 1;
  border: none;
  padding: 10px 8px;
  font-size: .95rem;
  outline: none;
  background: transparent;
  color: var(--cb-ink);
}
.chatbot-input input::placeholder { color: #9aa1ae; }
.chatbot-input button {
  flex: none;
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--cb-gold);
  color: var(--cb-ink);
  font-size: 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s var(--cb-ease), transform .2s var(--cb-ease);
}
.chatbot-input button:hover { background: var(--cb-gold-hi); transform: scale(1.06); }
.chatbot-input button:active { transform: scale(.96); }

/* -------------------------------------------------- Botón flotante -------- */
.chatbot-toggle-button {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 58px; height: 58px;
  background: var(--cb-gold);
  color: var(--cb-ink);
  border: none;
  font-size: 22px;
  border-radius: 18px;
  cursor: pointer;
  z-index: 9999;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 30px -10px rgba(255, 193, 7, .9);
  animation: cbFloat 3.5s ease-in-out infinite;
  transition: background .2s var(--cb-ease), transform .2s var(--cb-ease), box-shadow .2s var(--cb-ease);
}
/* Anillo de atención */
.chatbot-toggle-button::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 18px;
  box-shadow: 0 0 0 0 rgba(255, 193, 7, .5);
  animation: cbPing 2.4s var(--cb-ease) infinite;
}
.chatbot-toggle-button:hover {
  background: var(--cb-gold-hi);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 18px 34px -10px rgba(255, 193, 7, 1);
  animation-play-state: paused;
}
@keyframes cbFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes cbPing {
  0%   { box-shadow: 0 0 0 0 rgba(255, 193, 7, .45); }
  70%  { box-shadow: 0 0 0 18px rgba(255, 193, 7, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* -------------------------------------------------- Escribiendo… ---------- */
.typing-indicator {
  display: inline-block;
  background: #fff;
  border: 1px solid #ece9e2;
  border-radius: 16px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-style: italic;
  color: #777;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% { opacity: .5; }
  50% { opacity: 1; }
  100% { opacity: .5; }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle-button,
  .chatbot-toggle-button::after,
  .chatbot-header span::before { animation: none; }
}
@media (max-width: 420px) {
  .chatbot-container,
  .chatbot-container.expanded { width: calc(100vw - 32px); left: 16px; }
  .chatbot-toggle-button { left: 16px; }
}

/* En la tienda el chatbot se abre desde el botón "Soporte" del navbar */
#chatbot-toggle-button { display: none !important; }

/* ==========================================================================
   Indicador de escritura
   Tres puntos que laten, en lugar de un «...» plano. Es la señal que usa
   cualquier chat de atención, y hace que la espera se lea como alguien
   escribiendo y no como una página colgada.
   ========================================================================== */
.chat-escribiendo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 1.2em;
}

.chat-escribiendo span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .35;
  animation: chatLate 1.25s infinite ease-in-out;
}

.chat-escribiendo span:nth-child(2) { animation-delay: .18s; }
.chat-escribiendo span:nth-child(3) { animation-delay: .36s; }

@keyframes chatLate {
  0%, 60%, 100% { opacity: .3;  transform: translateY(0); }
  30%           { opacity: .95; transform: translateY(-3px); }
}

/* Los párrafos de la respuesta respiran; sin esto un texto de varias líneas
   sale como un bloque compacto y se lee peor. */
.chatbot-messages .message-bubble p { margin: 0 0 .55em; }
.chatbot-messages .message-bubble p:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .chat-escribiendo span { animation: none; opacity: .5; }
}
