/* =============================================
By: Ing Juan Manuel Malaver
Versión optimizada y responsiva
============================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1f293f;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  color: #1e293b;
}

.logo {
  width: 130px;
  margin-bottom: -8px;
}
.robot {
  width: 140px;
  opacity: 0.1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ======= CONTENEDOR GENERAL ======= */
.chat-container {
  width: 100%;
  max-width: 900px;
  height: 90vh;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

/* ======= ENCABEZADO ======= */
.chat-header {
  background: #1d4ed8;
  color: #fff;
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.chat-header svg{
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 5px;
}

.chat-header h1 {
  font-size: 20px;
  font-weight: 600;
}

.chat-header p {
  font-size: 13px;
  opacity: 0.9;
  margin-top: 4px;
}

/* ======= MENSAJES ======= */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: #ededed;
  scroll-behavior: smooth;
}

.message {
  margin-bottom: 16px;
  display: flex;
  animation: fadeIn 0.3s ease;
}

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

.message-content {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: 16px;
  line-height: 1.6;
  word-wrap: break-word;
  font-size: 15px;
}

/* Bot */
.message.bot .message-content {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* Usuario */
.message.user {
  justify-content: flex-end;
}

.message.user .message-content {
  background: #1d4ed8;
  color: #ffffff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}

/* Sistema */
.message.system .message-content {
  background: #e0f2fe;
  color: #075985;
  font-size: 13px;
  border-radius: 10px;
  max-width: 85%;
}

/* ======= INDICADOR DE ESCRITURA (FIJO ABAJO) ======= */
.typing-indicator {
  display: none;
  position: fixed;
  top: 75%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px;
  background: rgba(91, 95, 108, 0.569); /* color base con transparencia */
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.656);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.071);
  color: #ffffff;
  font-weight: 500;
  width: fit-content;
  z-index: 1000;
  transition: all 0.3s ease;
}

.typing-indicator.show {
  display: block;
}

.typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
  margin: 0 2px;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.1s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes typing {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-6px);
  }
}


/* ======= CAJA DE ENTRADA ======= */
.chat-input-container {
  padding: 14px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 25px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.chat-input:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

/* Botón enviar */
.send-button {
  padding: 12px 22px;
  background: #1d4ed8;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.send-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(29, 78, 216, 0.3);
}

.send-button:active {
  transform: translateY(0);
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ======= BOTONES RÁPIDOS ======= */
.quick-questions {
  padding: 12px 16px;
  background: #ededed;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.quick-questions svg{
    width: 16px;
    height: 16px;
  vertical-align: middle;
  margin-right: 4px;
}

.quick-btn {
  padding: 8px 14px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 18px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  transition: all 0.25s ease;
}

.quick-btn:hover {
  border-color: #1d4ed8;
  color: #1d4ed8;
  background: #eff6ff;
  transform: translateY(-2px);
}

/* ======= SCROLL ======= */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ======= LISTAS Y TEXTOS ======= */
ol, ul {
  margin: 10px 0;
  padding-left: 22px;
}

li {
  margin: 6px 0;
}

strong {
  color: #1d4ed8;
}

/* ======= ERRORES ======= */
.error-message {
  background: #fee2e2;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 10px 0;
  border-left: 4px solid #ef4444;
}

/* ======= RESPONSIVIDAD ======= */
@media (max-width: 768px) {
  .chat-container {
    height: 85vh;
    border-radius: 14px;
  }

  .chat-header h1 {
    font-size: 18px;
  }

  .chat-input {
    font-size: 14px;
  }

  .send-button {
    padding: 10px 18px;
    font-size: 14px;
  }

  .message-content {
    max-width: 85%;
    font-size: 14px;
    padding: 12px 14px;
  }
}
