/* VS Chat Widget — Mayorazgo Broker · Virtual Solutions */

#vs-chat-root,
#vs-chat-root * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------------- FAB ---------------- */
#vs-chat-root .vs-chat-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  border: none;
  border-radius: 999px;
  background: #1e5a8e;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.2s ease;
}

#vs-chat-root .vs-chat-fab:hover {
  background: #17466f;
  transform: translateY(-2px);
}

#vs-chat-root .vs-chat-fab--hidden {
  opacity: 0;
  pointer-events: none;
}

/* ---------------- Panel ---------------- */
#vs-chat-root .vs-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 999999;
  width: 370px;
  height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#vs-chat-root .vs-chat-panel.vs-chat-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ---------------- Header ---------------- */
#vs-chat-root .vs-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #1e5a8e;
  color: #fff;
  flex-shrink: 0;
}

#vs-chat-root .vs-chat-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #fff;
  padding: 3px;
  object-fit: contain;
}

#vs-chat-root .vs-chat-headtext {
  flex: 1;
  min-width: 0;
}

#vs-chat-root .vs-chat-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

#vs-chat-root .vs-chat-subtitle {
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.2;
}

#vs-chat-root .vs-chat-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  opacity: 0.85;
}

#vs-chat-root .vs-chat-close:hover {
  opacity: 1;
}

/* ---------------- Mensajes ---------------- */
#vs-chat-root .vs-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: #f7f8fa;
}

#vs-chat-root .vs-chat-msg {
  display: flex;
  margin-bottom: 10px;
}

#vs-chat-root .vs-chat-msg--user {
  justify-content: flex-end;
}

#vs-chat-root .vs-chat-msg--ai {
  justify-content: flex-start;
}

#vs-chat-root .vs-chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#vs-chat-root .vs-chat-msg--user .vs-chat-bubble {
  background: #1e5a8e;
  color: #fff;
  border-bottom-right-radius: 4px;
}

#vs-chat-root .vs-chat-msg--ai .vs-chat-bubble {
  background: #eceff3;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

/* ---------------- Typing dots ---------------- */
#vs-chat-root .vs-chat-typing .vs-chat-bubble {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 13px 16px;
}

#vs-chat-root .vs-chat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #93a1b3;
  animation: vs-chat-blink 1.2s infinite ease-in-out;
}

#vs-chat-root .vs-chat-dot:nth-child(2) { animation-delay: 0.15s; }
#vs-chat-root .vs-chat-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes vs-chat-blink {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-3px); }
}

/* ---------------- Input ---------------- */
#vs-chat-root .vs-chat-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e5e8ec;
  flex-shrink: 0;
}

#vs-chat-root .vs-chat-input {
  flex: 1;
  resize: none;
  border: 1px solid #d4d9e0;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.4;
  max-height: 120px;
  background: #fff;
  color: #1f2937;
  margin: 0;
  outline: none;
}

#vs-chat-root .vs-chat-input:focus {
  border-color: #1e5a8e;
  box-shadow: 0 0 0 2px rgba(30, 90, 142, 0.15);
}

#vs-chat-root .vs-chat-send {
  border: none;
  border-radius: 10px;
  background: #1e5a8e;
  color: #fff;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

#vs-chat-root .vs-chat-send:hover:not(:disabled) {
  background: #17466f;
}

#vs-chat-root .vs-chat-send:disabled {
  background: #b9c4d0;
  cursor: default;
}

/* ---------------- Footer ---------------- */
#vs-chat-root .vs-chat-footer {
  text-align: center;
  font-size: 11px;
  color: #8a94a1;
  padding: 6px 0 8px;
  background: #fff;
  flex-shrink: 0;
}

#vs-chat-root .vs-chat-footer a {
  color: #6b7684;
  text-decoration: none;
  font-weight: 600;
}

#vs-chat-root .vs-chat-footer a:hover {
  color: #1e5a8e;
}

/* ---------------- Mobile ---------------- */
@media (max-width: 480px) {
  #vs-chat-root .vs-chat-panel {
    right: 10px;
    left: 10px;
    bottom: 80px;
    width: auto;
    height: min(85vh, calc(100vh - 100px));
  }

  #vs-chat-root .vs-chat-fab {
    bottom: 16px;
    right: 16px;
  }
}
