/* ============================================
   Visitor Chat Widget — autoasistente.com
   ============================================ */

/* Bubble */
.vcw-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
  z-index: 10000;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  font-size: 1.4rem;
}
.vcw-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(37, 99, 235, 0.5);
}
.vcw-bubble.vcw-hidden { display: none; }

/* Bubble badge */
.vcw-bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* Overlay tooltip */
.vcw-tooltip {
  position: fixed;
  bottom: 92px;
  right: 24px;
  background: #fff;
  color: #1a1a2e;
  padding: 12px 18px;
  border-radius: 12px 12px 0 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 10000;
  max-width: 260px;
  line-height: 1.4;
  animation: vcwTooltipIn 0.4s ease-out;
  cursor: pointer;
  transition: opacity 0.3s;
}
.vcw-tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
}
.vcw-tooltip-close {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
}
.vcw-tooltip.vcw-hidden { display: none; }

@keyframes vcwTooltipIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Panel */
.vcw-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 540px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: vcwPanelIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vcw-panel.vcw-closing {
  animation: vcwPanelOut 0.2s ease-in forwards;
}
.vcw-panel.vcw-hidden { display: none; }

@keyframes vcwPanelIn {
  from { opacity: 0; transform: scale(0.6) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes vcwPanelOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to { opacity: 0; transform: scale(0.6) translateY(20px); }
}

/* Header */
.vcw-header {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.vcw-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.vcw-header-info { flex: 1; }
.vcw-header-name { font-weight: 600; font-size: 0.95rem; }
.vcw-header-status { font-size: 0.75rem; opacity: 0.85; display: flex; align-items: center; gap: 4px; }
.vcw-header-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; }
.vcw-header-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.15s;
}
.vcw-header-close:hover { background: rgba(255,255,255,0.3); }

/* Messages area */
.vcw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}
.vcw-messages::-webkit-scrollbar { width: 4px; }
.vcw-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Message bubbles */
.vcw-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-wrap: break-word;
  position: relative;
}
.vcw-msg-bot {
  align-self: flex-start;
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}
.vcw-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.vcw-msg-admin {
  align-self: flex-start;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-bottom-left-radius: 4px;
}
.vcw-msg-time {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 4px;
  display: block;
}
.vcw-msg-user .vcw-msg-time { text-align: right; }

/* Typing indicator */
.vcw-typing {
  align-self: flex-start;
  padding: 12px 18px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.vcw-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: vcwBounce 1.4s infinite;
}
.vcw-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.vcw-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes vcwBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Input area */
.vcw-input-area {
  padding: 12px 14px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  flex-shrink: 0;
}
.vcw-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.88rem;
  outline: none;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.15s;
}
.vcw-input:focus { border-color: #2563eb; }
.vcw-input::placeholder { color: #94a3b8; }
.vcw-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform 0.15s, opacity 0.15s;
  flex-shrink: 0;
}
.vcw-send:hover { transform: scale(1.08); }
.vcw-send:disabled { opacity: 0.5; cursor: default; transform: none; }

/* Name prompt */
.vcw-name-bar {
  padding: 8px 14px;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  flex-shrink: 0;
}
.vcw-name-bar input {
  flex: 1;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  outline: none;
  background: #fff;
  color: #1e293b;
}
.vcw-name-bar.vcw-hidden { display: none; }

/* Powered by */
.vcw-powered {
  text-align: center;
  padding: 6px;
  font-size: 0.65rem;
  color: #94a3b8;
  background: #fff;
  flex-shrink: 0;
}
.vcw-powered a { color: #2563eb; text-decoration: none; }

/* Mobile responsive */
@media (max-width: 640px) {
  .vcw-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    animation: vcwMobileIn 0.25s ease-out;
  }
  .vcw-panel.vcw-closing {
    animation: vcwMobileOut 0.2s ease-in forwards;
  }
  .vcw-bubble.vcw-panel-open { display: none; }
  .vcw-tooltip { bottom: 88px; right: 16px; max-width: 220px; }
  .vcw-bubble { bottom: 16px; right: 16px; }
}

@keyframes vcwMobileIn {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes vcwMobileOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(100%); }
}
