/* ============================================================
   El Jardín del Virrey — Asistente de Reservas (Chat Widget)
   ============================================================ */

#virrey-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  box-shadow: 0 12px 32px rgba(42, 33, 23, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s var(--ease-out), box-shadow .25s ease, bottom .3s var(--ease-out);
}
body.cookie-banner-visible #virrey-chat-launcher { bottom: 100px; }
body.cookie-banner-visible #virrey-chat-panel { bottom: 174px; }
#virrey-chat-launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 16px 40px rgba(42, 33, 23, .34); }
#virrey-chat-launcher svg { width: 26px; height: 26px; fill: var(--white); }
#virrey-chat-launcher .vc-close-icon { display: none; }
#virrey-chat-launcher.open .vc-chat-icon { display: none; }
#virrey-chat-launcher.open .vc-close-icon { display: block; }

#virrey-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #C0392B;
  border: 2px solid var(--off-white);
  animation: vcPulse 2.2s ease-in-out infinite;
}
#virrey-chat-launcher.open #virrey-chat-badge { display: none; }

@keyframes vcPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: .65; }
}

#virrey-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 98px;
  z-index: 10000;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: var(--off-white);
  border: 1px solid rgba(169, 113, 60, .22);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(42, 33, 23, .28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .28s var(--ease-out), visibility .28s var(--ease-out), transform .28s var(--ease-out), bottom .3s var(--ease-out);
}
#virrey-chat-panel.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.vc-header {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.vc-header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.vc-header-avatar img { width: 24px; height: 24px; object-fit: contain; filter: brightness(0) invert(1); }
.vc-header-text h3 { font-family: var(--font-display); color: var(--white); font-size: 1rem; font-weight: 600; line-height: 1.2; }
.vc-header-text p { color: rgba(255,255,255,.85); font-size: .74rem; letter-spacing: .04em; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.vc-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #6FCF97; display: inline-block; }

.vc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--paper);
  scroll-behavior: smooth;
}
.vc-messages::-webkit-scrollbar { width: 5px; }
.vc-messages::-webkit-scrollbar-thumb { background: rgba(169,113,60,.28); border-radius: 10px; }

.vc-msg { max-width: 84%; font-size: .87rem; line-height: 1.55; animation: vcFadeIn .25s ease; }
@keyframes vcFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.vc-msg-bot {
  align-self: flex-start;
  background: var(--white);
  color: var(--text-dark);
  border: 1px solid rgba(169,113,60,.16);
  border-radius: 14px 14px 14px 4px;
  padding: 11px 14px;
}
.vc-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--white);
  border-radius: 14px 14px 4px 14px;
  padding: 11px 14px;
}
.vc-msg strong { font-weight: 700; }
.vc-msg a { color: inherit; text-decoration: underline; }

.vc-typing {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid rgba(169,113,60,.16);
  border-radius: 14px 14px 14px 4px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
}
.vc-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  opacity: .5;
  animation: vcBounce 1.1s ease-in-out infinite;
}
.vc-typing span:nth-child(2) { animation-delay: .15s; }
.vc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes vcBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.vc-input-row {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: var(--white);
  border-top: 1px solid rgba(169,113,60,.16);
}
.vc-input-row textarea {
  flex: 1;
  resize: none;
  border: 1px solid rgba(42,33,23,.16);
  border-radius: 14px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: .87rem;
  color: var(--text-dark);
  max-height: 90px;
  line-height: 1.4;
  outline: none;
  transition: border-color .2s ease;
}
.vc-input-row textarea:focus { border-color: var(--gold); }
.vc-send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .18s ease, opacity .18s ease;
}
.vc-send-btn svg { width: 17px; height: 17px; fill: var(--white); margin-left: -1px; }
.vc-send-btn:hover { transform: scale(1.06); }
.vc-send-btn:disabled { opacity: .45; cursor: default; transform: none; }

.vc-footnote {
  text-align: center;
  font-size: .66rem;
  color: var(--text-gray);
  padding: 6px 10px 10px;
  background: var(--white);
}
.vc-footnote a { color: var(--gold-dark); font-weight: 600; }

@media (max-width: 480px) {
  #virrey-chat-panel { right: 16px; bottom: 90px; width: calc(100vw - 32px); height: calc(100vh - 150px); }
  #virrey-chat-launcher { right: 16px; bottom: 16px; }
}
