/* El chat de la página (templates/assistant/_web_chat.html). CSS propio,
   no Tailwind: el build de Tailwind solo incluye las clases que ya ve en
   las plantillas. Los colores salen del tema del hotel. */
#hc-chat {
  --hc-brand: var(--color-primary, #c62828);
  --hc-accent: var(--color-accent, #8f1d1d);
  --hc-cream: #fbf7f0;
  --hc-bot: #f1ece4;
  --hc-ink: #1f1b1a;
  --hc-muted: #6b625f;
  font-size: 15px;
  color: var(--hc-ink);
}
#hc-chat [hidden] {
  display: none !important;
}
.hc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Burbuja: encima del CTA «Ver disponibilidad» y del menú de abajo. */
.hc-launcher {
  position: fixed;
  right: 14px;
  bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
@media (min-width: 1024px) {
  .hc-launcher {
    right: 24px;
    bottom: 92px;
  }
}
.hc-fab {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--hc-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.hc-fab svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}
.hc-fab:focus-visible,
.hc-chip:focus-visible,
.hc-send:focus-visible {
  outline: 3px solid var(--hc-accent);
  outline-offset: 2px;
}
/* Foto del chat y punto verde de «en línea». */
/* Aro verde siempre, sea cual sea el color del hotel (pedido del dueño). */
.hc-fab-photo {
  padding: 0;
  background: #fff;
  border: 3px solid #22c55e;
  overflow: visible;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
/* The photo never goes past the green ring: the ring itself says «en línea»
   (no dot nor glow sticking out of it). */
.hc-fab-photo img {
  border-radius: 50%;
  clip-path: circle(50%);
}
.hc-fab-photo .hc-online {
  display: none;
}
@media (prefers-reduced-motion: no-preference) {
  .hc-fab-photo {
    animation: hc-ring 2.4s ease-in-out infinite;
  }
  @keyframes hc-ring {
    0%,
    100% {
      border-color: #22c55e;
    }
    50% {
      border-color: #86efac;
    }
  }
}
.hc-fab img,
.hc-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.hc-online {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
}
.hc-fab .hc-online {
  right: 1px;
  bottom: 1px;
  width: 15px;
  height: 15px;
}
@media (prefers-reduced-motion: no-preference) {
  .hc-online {
    animation: hc-pulse 2.4s ease-out infinite;
  }
  @keyframes hc-pulse {
    0% {
      box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    }
    70% {
      box-shadow: 0 0 0 7px rgba(34, 197, 94, 0);
    }
    100% {
      box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
  }
}
.hc-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #dc2626;
  border: 2px solid #fff;
}
.hc-invite {
  position: relative;
  max-width: 230px;
  background: #fff;
  border: 1px solid #e7e1da;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 28px 10px 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
}
.hc-invite-text {
  margin: 0;
}
.hc-invite-close {
  position: absolute;
  top: 2px;
  right: 4px;
  border: 0;
  background: none;
  font-size: 18px;
  color: var(--hc-muted);
  cursor: pointer;
}

/* Panel: pantalla completa en el celular, ventana en computadora. */
.hc-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: #fff;
}
@media (min-width: 640px) {
  .hc-panel {
    inset: auto 24px 24px auto;
    width: 380px;
    height: min(620px, calc(100vh - 48px));
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  }
}
.hc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--hc-brand);
  color: #fff;
}
.hc-avatar {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: var(--hc-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
}
.hc-head-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.hc-head-text small {
  opacity: 0.9;
  font-size: 12px;
}
.hc-close {
  margin-left: auto;
  border: 0;
  background: none;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.hc-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--hc-cream);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hc-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hc-bubble {
  max-width: 85%;
  padding: 9px 12px;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.hc-bot {
  align-self: flex-start;
  background: var(--hc-bot);
  border-radius: 16px 16px 16px 4px;
}
.hc-agent {
  align-self: flex-start;
  background: #e7f5ec;
  border-radius: 16px 16px 16px 4px;
}
.hc-agent-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #166534;
}
.hc-guest {
  align-self: flex-end;
  background: var(--hc-accent);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.hc-note {
  align-self: center;
  font-size: 12px;
  color: var(--hc-muted);
  background: #fff;
  border: 1px solid #ece6df;
  border-radius: 999px;
  padding: 3px 10px;
  text-align: center;
}
.hc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hc-chip {
  border: 1.5px solid var(--hc-brand);
  color: var(--hc-brand);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.hc-chip:hover {
  background: color-mix(in srgb, var(--hc-brand) 8%, white);
}
.hc-chip[disabled] {
  opacity: 0.45;
  cursor: default;
}
.hc-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.hc-card {
  flex: 0 0 78%;
  max-width: 260px;
  background: #fff;
  border: 1px solid #eadfd6;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.hc-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.hc-card-text {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: pre-line;
}
.hc-card-text span {
  color: var(--hc-muted);
  font-size: 13px;
}
.hc-card .hc-card-btn {
  border: 0;
  border-top: 1px solid #f0e8e0;
  background: #fff;
  color: var(--hc-brand);
  font-weight: 700;
  padding: 9px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.hc-image {
  align-self: flex-start;
  max-width: 220px;
  border-radius: 12px;
  border: 1px solid #eadfd6;
  background: #fff;
}
.hc-upload {
  align-self: flex-start;
}
.hc-typing {
  align-self: flex-start;
  color: var(--hc-muted);
  font-size: 13px;
}

/* Caja para escribir. */
.hc-composer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eee;
  background: #fff;
}
.hc-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e3dcd5;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 16px;
}
.hc-send,
.hc-attach {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.hc-send {
  background: var(--hc-brand);
  color: #fff;
}
.hc-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.hc-attach {
  color: var(--hc-muted);
}
.hc-attach svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
@media (prefers-reduced-motion: no-preference) {
  .hc-invite {
    animation: hc-in 0.3s ease-out;
  }
  @keyframes hc-in {
    from {
      transform: translateY(6px);
      opacity: 0;
    }
  }
}
@media (max-width: 639px) {
  html.hc-chat-open {
    overflow: hidden;
  }
}

/* Aviso sutil: la burbuja se mueve un poco y su aro verde late una vez. */
@media (prefers-reduced-motion: no-preference) {
  .hc-fab.hc-wiggle {
    animation: hc-wiggle 0.9s ease-in-out;
  }
  .hc-fab.hc-wiggle::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid #22c55e;
    animation: hc-ripple 1.1s ease-out;
    pointer-events: none;
  }
  @keyframes hc-wiggle {
    0%, 100% { transform: rotate(0) scale(1); }
    15% { transform: rotate(-10deg) scale(1.06); }
    30% { transform: rotate(8deg) scale(1.06); }
    45% { transform: rotate(-6deg) scale(1.04); }
    60% { transform: rotate(4deg) scale(1.02); }
    75% { transform: rotate(-2deg) scale(1); }
  }
  @keyframes hc-ripple {
    from { transform: scale(0.9); opacity: 0.9; }
    to { transform: scale(1.35); opacity: 0; }
  }
}
