@charset "UTF-8";

/* =====================================================================
   Chatbot -- burbuja flotante + drawer
   ===================================================================== */

/* ---------- Boton flotante ---------- */
.chat-trigger {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 56px;
  padding: 0 1.1rem 0 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--red-1), var(--red-2));
  color: #fff;
  font-family: var(--body);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 20px 48px -16px rgba(176, 16, 24, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.3s var(--ease-out), filter 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  isolation: isolate;
}

.chat-trigger::before {
  /* Shimmer en hover */
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-18deg);
  transition: left 0.8s var(--ease-out);
  z-index: -1;
}

.chat-trigger:hover {
  transform: translateY(-3px);
  filter: brightness(1.08);
  box-shadow: 0 26px 60px -16px rgba(217, 33, 50, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.chat-trigger:hover::before { left: 140%; }

.chat-trigger-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  position: relative;
}

.chat-trigger-icon img {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.35));
  animation: triggerSpin 24s linear infinite;
}

@keyframes triggerSpin {
  to { transform: rotate(360deg); }
}

/* Punto de "online" en el boton */
.chat-trigger-icon::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #34d399;
  border: 2px solid var(--red-1);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: onlinePulse 2.2s ease-in-out infinite;
}

@keyframes onlinePulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
  100% { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); }
}

.chat-trigger.--hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  pointer-events: none;
}

/* ---------- Overlay ---------- */
.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
}

.chat-overlay.--open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Drawer ---------- */
.chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  z-index: 100;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at top, rgba(217, 33, 50, 0.10), transparent 50%),
    linear-gradient(180deg, #0a0a12 0%, #050507 100%);
  border-left: 1px solid var(--line-hi);
  box-shadow: -40px 0 80px -30px rgba(0, 0, 0, 0.7);
  transform: translateX(100%);
  transition: transform 0.5s var(--ease-out);
}

.chat-drawer.--open { transform: translateX(0); }

/* En mobile pasa a sheet desde abajo */
@media (max-width: 640px) {
  .chat-drawer {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 88vh;
    max-height: 88vh;
    border-left: none;
    border-top: 1px solid var(--line-hi);
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    box-shadow: 0 -40px 80px -20px rgba(0, 0, 0, 0.7);
  }
  .chat-drawer.--open { transform: translateY(0); }

  /* Indicador de arrastre estilo iOS */
  .chat-drawer::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
  }
}

/* ---------- Header del drawer ---------- */
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 640px) { .chat-header { padding-top: 1.6rem; } }

.chat-header-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red-1), var(--red-2));
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.chat-header-avatar img {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
}

.chat-header-avatar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #34d399;
  border: 2px solid #0a0a12;
}

.chat-header-info { flex: 1; min-width: 0; }

.chat-header-info h4 {
  margin: 0;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.chat-header-info p {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.chat-header-info p .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  margin-right: 0.45rem;
  vertical-align: 1px;
  animation: pulseDot 2s ease-in-out infinite;
}

.chat-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease, transform 0.25s var(--ease-out);
}

.chat-close:hover {
  color: var(--ink);
  border-color: var(--line-hi);
  background: rgba(255, 255, 255, 0.06);
  transform: rotate(90deg);
}

.chat-close svg { width: 18px; height: 18px; }

/* ---------- Cuerpo / mensajes ---------- */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

/* Estado vacio con sugerencias */
.chat-welcome {
  padding: 1.2rem 0.5rem;
  text-align: center;
  animation: msgIn 0.6s var(--ease-out) both;
}

.chat-welcome-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(217, 33, 50, 0.25), transparent 60%);
}

.chat-welcome-mark img {
  width: 52px;
  height: 52px;
  animation: triggerSpin 30s linear infinite;
  filter: drop-shadow(0 0 18px rgba(217, 33, 50, 0.55));
}

.chat-welcome h5 {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.chat-welcome p {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0 0 1.2rem;
  line-height: 1.5;
}

.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.chat-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink-soft);
  font-family: var(--body);
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.25s var(--ease-out), color 0.25s ease;
}

.chat-suggestion:hover {
  border-color: var(--line-warm);
  background: rgba(217, 33, 50, 0.05);
  color: var(--ink);
  transform: translateX(3px);
}

.chat-suggestion::after {
  content: "→";
  color: var(--red-3);
  font-family: var(--mono);
  opacity: 0.6;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-suggestion:hover::after { opacity: 1; transform: translateX(2px); }

/* Mensajes */
.msg {
  display: flex;
  gap: 0.6rem;
  max-width: 88%;
  animation: msgIn 0.45s var(--ease-out) both;
}

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

.msg-bubble {
  padding: 0.7rem 0.95rem;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.msg-time {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted-2);
  margin-top: 0.3rem;
  letter-spacing: 0.04em;
}

/* Mensaje del bot */
.msg.--bot {
  align-self: flex-start;
}

.msg.--bot .msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red-1), var(--red-2));
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg.--bot .msg-avatar img {
  width: 20px;
  height: 20px;
}

.msg.--bot .msg-bubble {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--ink);
  border-top-left-radius: 4px;
}

/* Mensaje del usuario */
.msg.--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg.--user .msg-bubble {
  background: linear-gradient(135deg, var(--red-1), var(--red-2));
  color: #fff;
  border-top-right-radius: 4px;
}

.msg.--user .msg-time { text-align: right; }

/* Typing indicator */
.msg-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.85rem 0.95rem;
}

.msg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingDot 1.4s ease-in-out infinite;
}

.msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.msg-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ---------- Footer del drawer (input) ---------- */
.chat-footer {
  border-top: 1px solid var(--line);
  padding: 0.85rem 1rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.chat-input-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  border: 1px solid var(--line-hi);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem 0.4rem 0.4rem 0.85rem;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.chat-input-wrap:focus-within {
  border-color: var(--red-2);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(217, 33, 50, 0.12);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--body);
  font-size: 0.92rem;
  padding: 0.5rem 0;
  resize: none;
  max-height: 120px;
  outline: none;
  line-height: 1.45;
}

.chat-input::placeholder { color: var(--muted-2); }

.chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--red-1), var(--red-2));
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), filter 0.25s ease;
}

.chat-send:hover:not(:disabled) {
  transform: scale(1.08) rotate(-12deg);
  filter: brightness(1.1);
}

.chat-send:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted-2);
  cursor: not-allowed;
}

.chat-send svg { width: 16px; height: 16px; }

.chat-disclaimer {
  display: block;
  margin-top: 0.55rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted-2);
  letter-spacing: 0.04em;
}

.chat-disclaimer span { color: var(--cyan-soft); }
