/* Fuente*/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --sva-color: #0511F2;
  --sva-color-dark: #0540F2;
  --sva-bg-light: #ffffff;
  --sva-bg-gray: #F0F0F0;
  --sva-radius: 16px;
  --sva-font: 'Inter', sans-serif;
  --sva-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  --sva-shadow-light: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Botón flotante */
.sva-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--sva-color);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  box-shadow: var(--sva-shadow);
  cursor: pointer;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
.sva-chat-launcher:hover {
  background-color: var(--sva-color-dark);
  transform: scale(1.05);
}
.sva-chat-icon {
  display: block;
  width: 34px;
  height: 34px;
  background-color: white;
  mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="black" xmlns="http://www.w3.org/2000/svg"><path d="M2 21l1.65-4.95A8.963 8.963 0 0 1 2 11c0-4.97 4.03-9 9-9s9 4.03 9 9-4.03 9-9 9c-1.78 0-3.44-.52-4.85-1.45L2 21z"/></svg>') center / contain no-repeat;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="black" xmlns="http://www.w3.org/2000/svg"><path d="M2 21l1.65-4.95A8.963 8.963 0 0 1 2 11c0-4.97 4.03-9 9-9s9 4.03 9 9-4.03 9-9 9c-1.78 0-3.44-.52-4.85-1.45L2 21z"/></svg>') center / contain no-repeat;
}

/* Ventana del chatbot*/
.sva-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: 95%;
  max-height: 80vh;
  background-color: var(--sva-bg-light);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  font-family: var(--sva-font);
  border: 1px solid #e1e5ea;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}
.sva-chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Header*/
.sva-header {
  background-color: var(--sva-color);
  color: #ffffff;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  letter-spacing: 0.2px;
}
.sva-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.sva-close:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Cuerpo del chat*/
.sva-body {
  background-color: var(--sva-bg-gray);
  flex-grow: 1;
  padding: 16px 18px;
  overflow-y: auto;
  min-height: 320px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
  transition: background-color 0.3s ease;
}
/* Estética scrollbar (Chrome, Edge, Safari) */
.sva-body::-webkit-scrollbar {
  width: 6px;
}
.sva-body::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
}
.sva-body::-webkit-scrollbar-track {
  background: transparent;
}

/* Mensajes generales */
.sva-message {
  margin: 6px 0;
  padding: 12px 16px;
  border-radius: 20px;
  max-width: 85%;
  line-height: 1.6;
  font-size: 14px;
  font-weight: 400;
  word-wrap: break-word;
  white-space: pre-line;
  box-shadow: var(--sva-shadow-light);
  transition: background-color 0.3s ease, transform 0.2s ease;
  /* otras propiedades */
  white-space: pre-line;
}
/* Usuario */
.sva-message.user {
  background-color: var(--sva-color);
  color: #ffffff;
  align-self: flex-end;
  text-align: right;
  border-bottom-right-radius: 6px;
}
/* Bot */
.sva-message.bot {
  background-color: #ffffff;
  color: #333;
  border: 1px solid #e1e5ea;
  align-self: flex-start;
  text-align: left;
  border-bottom-left-radius: 6px;
}
/* Enlaces dentro de respuestas del bot */
.sva-message.bot a {
  color: #0a66c2;
  border: 1px solid rgba(10, 102, 194, 0.2);
  border-radius: 6px;
  padding: 4px 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  display: inline-block;
  margin: 2px 2px 0;
  background-color: #f0f8ff;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.sva-message.bot a:hover {
  background-color: #dbeeff;
  border-color: #0a66c2;
  text-decoration: none;
}

/* Formulario */
#sva-chat-form {
  display: flex;
  border-top: 1px solid #e1e5ea;
  background-color: #fff;
  padding: 10px;
  gap: 8px;
}
/* Input */
#sva-chat-input {
  flex-grow: 1;
  border: 1px solid #ced4da;
  border-radius: var(--sva-radius);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  font-family: var(--sva-font);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
#sva-chat-input:focus {
  border-color: var(--sva-color);
  box-shadow: 0 0 8px var(--sva-color);
}
/* Botón */
#sva-chat-form button {
  background-color: var(--sva-color);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--sva-radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 8px rgba(13, 27, 42, 0.2);
  user-select: none;
}
#sva-chat-form button:hover,
#sva-chat-form button:focus {
  background-color: var(--sva-color-dark);
  box-shadow: 0 6px 12px rgba(10, 44, 91, 0.4);
  outline: none;
}

/* Footer credit mejorado */
.sva-credit {
  text-align: center;
  font-size: 12px;
  color: #64707d;
  padding: 12px 0;
  background-color: #f9fafb;
  border-top: 1px solid #dfe3e6;
  font-family: var(--sva-font);
  user-select: none;
  letter-spacing: 0.2px;
}
.sva-credit a {
  color: var(--sva-color);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.25s ease, text-decoration 0.25s ease;
  cursor: pointer;
}
.sva-credit a:hover {
  color: var(--sva-color-dark);
  text-decoration: underline;
  outline: none;
}
.sva-credit::before {
  content: "🧠 ";
  font-size: 13px;
  opacity: 0.7;
  margin-right: 4px;
}

/* Animación */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 480px) {
  .sva-chat-window {
    width: 95%;
    right: 2.5%;
    bottom: 90px;
  }
  .sva-chat-launcher {
    bottom: 16px;
    right: 16px;
    width: 66px;
    height: 66px;
  }
}