/* =========================
   BOTÓN DE REINICIO
========================= */
.reset-btn {
  margin-left: auto;
  background: var(--white);
  color: var(--secondary-color);
  border: 2px solid var(--secondary-color);
  border-radius: var(--border-radius-md);
  padding: 10px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
  outline: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reset-btn:hover {
  background: var(--secondary-color);
  color: var(--white);
  transform: scale(1.06) rotate(-2deg);
  box-shadow: var(--shadow-xl);
}
/* =========================
   VARIABLES CSS PARA CONSISTENCIA
========================= */
:root {
  --primary-color: #032647;
  --secondary-color: #008de6;
  --accent-color: #015185;
  --tertiary-color: #032647;
  --light-blue: #eff6ff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
}

/* =========================
   ESTILOS GENERALES
========================= */
html,
body {
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  /* Eliminado gradiente, usando color sólido */
  background: var(--secondary-color);
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.chat-container {
  width: 100vw;
  height: 100vh;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  background: var(--white);
}

/* =========================
   HEADER DEL CHAT
========================= */
.chat-header {
  /* Añadiendo degradado moderno y efectos visuales sofisticados */
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 50%, var(--secondary-color) 100%);
  color: var(--white);
  padding: 28px 32px;
  font-size: 1.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  letter-spacing: -0.025em;
  /* Sombras más sofisticadas y efectos de profundidad */
  box-shadow: 0 8px 32px -8px rgba(3, 38, 71, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0
    rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  /* Efectos de cristal modernos */
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

/* Añadiendo efecto de brillo sutil en el header */
.chat-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 3s infinite;
  pointer-events: none;
}

/* Animación de brillo sutil */
@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Efecto de overlay para mayor profundidad */
.chat-header::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%, rgba(0, 0, 0, 0.05) 100%);
  pointer-events: none;
}

.chat-header .avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--white);
  /* Mejorando el borde y sombra del avatar */
  border: 3px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 2;
}

.chat-header .avatar:hover {
  transform: scale(1.08) translateY(-2px);
  /* Sombra más dramática en hover */
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.15), inset 0 1px 0
    rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Mejorando la tipografía del título del header */
.chat-header h1,
.chat-header .title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 2;
  background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.9) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* =========================
   MENSAJES DEL CHAT
========================= */
.chat-messages {
  flex: 1;
  padding: 32px 24px;
  overflow-y: auto;
  background: var(--gray-50);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

.chat-messages::after {
  content: "";
  display: table;
  clear: both;
}

/* Scrollbar personalizado */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* -------------------------
   MENSAJE DEL BOT
------------------------- */
.bot-message {
  margin: 16px 0;
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-100);
  animation: slideInLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  max-width: 85%;
  margin-left: 0;
  margin-right: auto;
  float: left;
  clear: both;
}

.bot-message::before {
  content: "";
  position: absolute;
  top: 20px;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid var(--white);
}

/* Cabecera del mensaje del bot */
.bot-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.bot-avatar-large {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent-color);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.bot-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--secondary-color);
  letter-spacing: -0.02em;
}

/* Separador */
.bot-separator {
  width: 100%;
  margin: 12px 0 16px 0;
  border: none;
  border-top: 1px solid var(--gray-200);
  opacity: 0.8;
}

/* Texto del mensaje */
.bot-text {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.6;
  text-align: left;
  letter-spacing: -0.01em;
}

/* -------------------------
   MENSAJE DEL USUARIO
------------------------- */
.user-message {
  margin: 16px 0 16px auto;
  background: var(--accent-color);
  color: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 20px 24px;
  display: block;
  max-width: 75%;
  box-shadow: var(--shadow-md);
  font-weight: 500;
  animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  margin-left: auto;
  margin-right: 0;
  position: relative;
  letter-spacing: -0.01em;
  width: fit-content;
  float: right;
  clear: both;
}

.user-message::after {
  content: "";
  position: absolute;
  top: 20px;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid var(--accent-color);
}

/* =========================
   BLOQUE DEL MENÚ PRINCIPAL
========================= */
.menu-block {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--gray-100);
  transition: box-shadow 0.2s ease;
}

.menu-block:hover {
  box-shadow: var(--shadow-lg);
}

.menu-title {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 16px;
  color: var(--secondary-color);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-btns-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  justify-content: flex-start;
}

.menu-btn {
  min-width: 120px;
  margin: 0;
  font-size: 0.95rem;
  border-radius: var(--border-radius-md);
  padding: 12px 20px;
  /* Eliminado gradiente, usando color sólido */
  background: var(--secondary-color);
  color: var(--white);
  border: none;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.menu-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.menu-btn:hover {
  /* Eliminado gradiente, usando color sólido */
  background: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.menu-btn:active {
  transform: translateY(0);
}

/* Avatar grande del menú principal */
.menu-avatar {
  max-width: 160px;
  max-height: 160px;
  width: 100%;
  height: auto;
  display: block;
  margin: 32px auto 20px auto;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  background: var(--white);
  object-fit: cover;
  border: 4px solid var(--gray-100);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.menu-avatar:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-xl);
}

/* =========================
   INPUT DE CHAT
========================= */
.chat-input {
  display: flex;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  padding: 20px 24px;
  box-shadow: var(--shadow-lg);
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.chat-input input {
  flex: 1;
  padding: 16px 20px;
  border: 2px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--text-primary);
  font-size: 1rem;
  border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
  font-weight: 400;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
  outline: none;
}

.chat-input input:focus {
  border-color: var(--accent-color);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-input input::placeholder {
  color: var(--text-secondary);
}

.chat-input button {
  /* Eliminado gradiente, usando color sólido */
  background: var(--secondary-color);
  color: var(--white);
  border: none;
  padding: 16px 32px;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.chat-input button:hover {
  /* Eliminado gradiente, usando color sólido */
  background: var(--accent-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.chat-input button:active {
  transform: translateY(0);
}

/* =========================
   ANIMACIONES
========================= */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* =========================
   RESPONSIVE DESIGN
========================= */
@media (min-width: 768px) {
  .chat-messages {
    /* Reducido padding lateral para hacer el chat más ancho */
    padding: 40px 8%;
  }

  .bot-message {
    max-width: 80%;
  }

  .user-message {
    max-width: 70%;
  }
}

@media (min-width: 1024px) {
  .chat-messages {
    /* Reducido padding lateral para hacer el chat más ancho en desktop */
    padding: 48px 10%;
    font-size: 1.1rem;
  }

  .chat-header {
    padding: 36px 48px;
    font-size: 1.8rem;
    /* Sombras más pronunciadas en desktop */
    box-shadow: 0 12px 40px -12px rgba(3, 38, 71, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0
      rgba(255, 255, 255, 0.12);
  }

  .chat-header .avatar {
    width: 68px;
    height: 68px;
  }

  /* Tipografía mejorada para desktop */
  .chat-header h1,
  .chat-header .title {
    font-size: 1.8rem;
  }

  .menu-btn {
    padding: 16px 28px;
    font-size: 1rem;
    min-width: 140px;
  }

  .chat-input {
    /* Reducido padding lateral para hacer el input más ancho */
    padding: 24px 10%;
  }

  .chat-input input,
  .chat-input button {
    padding: 18px 24px;
    font-size: 1.1rem;
  }
}

@media (max-width: 640px) {
  .chat-header {
    font-size: 1.3rem;
    padding: 24px 20px;
    gap: 18px;
    /* Sombras adaptadas para móvil */
    box-shadow: 0 6px 24px -6px rgba(3, 38, 71, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0
      rgba(255, 255, 255, 0.08);
  }

  .chat-header .avatar {
    width: 52px;
    height: 52px;
  }

  /* Tipografía optimizada para móvil */
  .chat-header h1,
  .chat-header .title {
    font-size: 1.3rem;
    letter-spacing: -0.02em;
  }

  .bot-message,
  .user-message {
    margin: 12px 0;
    padding: 16px 20px;
    max-width: 90%;
  }

  .menu-block {
    padding: 20px 16px;
    margin: 12px 0;
  }

  .menu-title {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .menu-btns-row {
    gap: 8px;
  }

  .menu-btn {
    min-width: 100px;
    font-size: 0.9rem;
    padding: 10px 16px;
  }

  .menu-avatar {
    max-width: 120px;
    max-height: 120px;
    margin: 20px auto 16px auto;
  }

  .chat-input {
    padding: 16px;
  }

  .chat-input input,
  .chat-input button {
    padding: 14px 16px;
    font-size: 0.95rem;
  }

  .bot-avatar-large {
    width: 36px;
    height: 36px;
  }

  .bot-name {
    font-size: 1rem;
  }
}

/* =========================
   ESTADOS DE CARGA Y EFECTOS
========================= */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible para navegación por teclado */
.menu-btn:focus-visible,
.chat-input button:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.chat-input input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
/* Botón WhatsApp */
.whatsapp-button {
    display: inline-block;
    background-color: #25D366;
    color: white !important;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
.whatsapp-button:hover {
    background-color: #1ebe5a;
}

/* Botón PDF */
.pdf-button {
    display: inline-block;
    background-color: #008de6;
    color: white !important;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
.pdf-button:hover {
    background-color: #026bb5;
}
