/* ======================================================
   1. VARIABLES (colores, fuentes)
====================================================== */

:root {
  --bg-main: rgba(15, 15, 30, 0.65);
  --bg-glass: rgba(255, 255, 255, 0.12);
  --bg-user: #111827;
  --bg-assistant: rgba(243, 244, 246, 0.95);

  --color-text-light: #e5e7eb;
  --color-text-dark: #0f172a;
  --accent: #6366f1;

  --radius-lg: 16px;
  --radius-md: 14px;
  --radius-sm: 6px;

  --font-main: 'Inter', system-ui, sans-serif;
}


/* ======================================================
   2. CONTENEDOR GENERAL DEL CHAT
====================================================== */

.chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;

  width: 360px;
  height: 520px;

  display: flex;
  flex-direction: column;

  background: var(--bg-main);
  backdrop-filter: blur(18px);

  border-radius: var(--radius-lg);
  border: 1px solid var(--bg-glass);

  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
  font-family: var(--font-main);

  overflow: hidden;
  z-index: 9999;
}


/* ======================================================
   3. CABECERA
====================================================== */

.chat-header {
  padding: 14px 16px;

  background: linear-gradient(
    135deg,
    rgba(99,102,241,0.9),
    rgba(129,140,248,0.9)
  );

  color: white;
  font-weight: 600;
  font-size: 15px;

  display: flex;
  align-items: center;
  gap: 8px;
}


/* ======================================================
   4. ZONA DE MENSAJES
====================================================== */

.chat-messages {
  flex: 1;
  padding: 14px;

  display: flex;
  flex-direction: column;
  gap: 10px;

  overflow-y: auto;
}


/* Scroll elegante */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
}


/* ======================================================
   5. MENSAJES DEL USUARIO
====================================================== */

.message.user {
  align-self: flex-end;
  max-width: 80%;

  background: var(--bg-user);
  color: var(--color-text-light);

  padding: 10px 14px;
  border-radius: var(--radius-md) var(--radius-sm) var(--radius-md) var(--radius-md);

  font-size: 14px;
  line-height: 1.5;
}


/* ======================================================
   6. MENSAJES DEL ASISTENTE + AVATAR
====================================================== */

.message.assistant {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 80%;
}

/* Avatar */
.message.assistant .avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;

  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #818cf8);

  display: flex;
  align-items: center;
  justify-content: center;

  color: white;
  font-size: 13px;
  font-weight: 600;

  box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}

/* Burbuja asistente */
.message.assistant .bubble {
  background: var(--bg-assistant);
  color: var(--color-text-dark);

  padding: 10px 14px;
  border-radius: var(--radius-sm) var(--radius-md) var(--radius-md) var(--radius-md);

  font-size: 14px;
  line-height: 1.5;

  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}


/* ======================================================
   7. INPUT Y BOTÓN
====================================================== */

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;

  border-top: 1px solid rgba(255,255,255,0.1);
}

.chat-input input {
  flex: 1;

  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;

  padding: 10px 12px;
  color: var(--color-text-light);

  font-size: 14px;
  outline: none;
}

.chat-input input::placeholder {
  color: rgba(229,231,235,0.6);
}

.chat-input button {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  border: none;
  border-radius: 10px;

  padding: 0 16px;
  color: white;
  font-weight: 600;
  cursor: pointer;

  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-input button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99,102,241,0.45);
}


/* ======================================================
   8. ANIMACIONES
====================================================== */

.message {
  animation: fadeInUp 0.25s ease both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ======================================================
   9. RESPONSIVE
====================================================== */

@media (max-width: 480px) {
  .chat-container {
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
}
/* ======================================================
   CHAT LAUNCHER (BURBUJA FLOTA)
====================================================== */

.chat-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;

  width: 56px;
  height: 56px;

  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #818cf8);

  display: flex;
  align-items: center;
  justify-content: center;

  color: white;
  font-size: 22px;
  cursor: pointer;

  box-shadow: 0 12px 30px rgba(99,102,241,0.45);
  z-index: 9998;
}

.chat-launcher:hover {
  transform: scale(1.05);
}
