/* Asistente Virtual - widget (tema celeste, consistente con el sitio) */

#chat-root { position: fixed; right: 1.2rem; bottom: 6.4rem; z-index: 300; }

#chat-toggle {
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, #0891b2, #0b2247);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(8, 28, 54, .45);
  transition: transform .15s;
}
#chat-toggle:hover { transform: translateY(-2px) scale(1.04); }

#chat-panel {
  position: absolute; right: 0; bottom: 0;
  width: min(370px, calc(100vw - 2.4rem));
  height: min(520px, calc(100vh - 2.4rem));
  display: flex; flex-direction: column;
  background: #fff;
  border: 1px solid var(--sky-200, #bae6fd);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(3, 105, 161, .22);
  overflow: hidden;
  opacity: 0; transform: translateY(12px) scale(.98); pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
#chat-panel.open { opacity: 1; transform: none; pointer-events: auto; }

.chat-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: .9rem 1.1rem;
  background: linear-gradient(135deg, #0891b2, #0b2247);
  color: #fff; flex: 0 0 auto;
}
.chat-title { font-weight: 800; font-size: 1rem; }
.chat-sub { font-size: .75rem; opacity: .9; }
#chat-close {
  background: transparent; border: none; color: #fff;
  font-size: 1.4rem; line-height: 1; cursor: pointer; padding: .2rem .4rem;
}

.chat-body {
  flex: 1 1 auto; overflow-y: auto; padding: .9rem 1rem;
  background: var(--sky-50, #f0f9ff);
  display: flex; flex-direction: column; gap: .5rem;
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg .bubble {
  max-width: 82%; padding: .6rem .85rem; border-radius: 14px;
  font-size: .9rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.chat-msg.bot .bubble { background: #fff; border: 1px solid var(--sky-200, #bae6fd); border-bottom-left-radius: 4px; }
.chat-msg.user .bubble { background: #0ea5e9; color: #fff; border-bottom-right-radius: 4px; }
.chat-msg .bubble a { color: #0369a1; font-weight: 600; }

.chat-msg.typing .bubble { display: flex; gap: 4px; padding: .8rem 1rem; }
.chat-msg.typing .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #7dd3fc;
  animation: chat-pop 1s infinite;
}
.chat-msg.typing .dot:nth-child(2) { animation-delay: .15s; }
.chat-msg.typing .dot:nth-child(3) { animation-delay: .3s; }
@keyframes chat-pop { 0%, 80%, 100% { transform: none; opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }

.chat-quick {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: .4rem;
  padding: .55rem .9rem; background: #fff; border-top: 1px solid var(--sky-100, #e0f2fe);
}
.chat-quick button {
  border: 1px solid var(--sky-200, #bae6fd); background: var(--sky-50, #f0f9ff);
  color: var(--primary-deep, #0369a1); font-size: .8rem; font-weight: 600;
  padding: .4rem .7rem; border-radius: 20px; cursor: pointer;
  transition: background .15s;
}
.chat-quick button:hover { background: var(--sky-100, #e0f2fe); }

.chat-input {
  flex: 0 0 auto; display: flex; gap: .5rem; padding: .7rem .9rem;
  background: #fff; border-top: 1px solid var(--sky-100, #e0f2fe);
}
.chat-input input {
  flex: 1; border: 1px solid var(--sky-200, #bae6fd); border-radius: 10px;
  padding: .6rem .75rem; font-size: .9rem; font-family: inherit; outline: none;
}
.chat-input input:focus { border-color: var(--primary, #0ea5e9); box-shadow: 0 0 0 3px rgba(14, 165, 233, .12); }
.chat-input button {
  border: none; background: #0ea5e9; color: #fff; font-weight: 700;
  padding: .6rem 1rem; border-radius: 10px; cursor: pointer;
}
.chat-input button:hover { background: #0284c7; }

/* El widget flota sobre el botón fijo de WhatsApp (.wa-fixed) */
@media (max-width: 600px) {
  #chat-toggle { width: 54px; height: 54px; }
  #chat-panel { height: min(480px, calc(100vh - 7.6rem)); width: calc(100vw - 2.4rem); }
}