:root {
  --primary-color: #d3d3db;
  /* Color base claro */
  --primary-dark: #17375D;
  --secondary-color: #f8f9fa;
  --text-color: #333;
  --light-gray: #e9ecef;
  --dark-gray: #6c757d;
  --bg-tertiary: #f1f5f9;
  --border-light: #334155;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --primary-400: #3b82f6;
}

body {
  background-color: #f8f9fa;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  /* Para iPhone con notch */
}

.chat-container {
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background-color: white;
  height: calc(100vh - 40px);
  max-height: 800px;
  display: flex;
  flex-direction: column;
}

.chat-header {
  background-color: var(--primary-color);
  color: black;
  padding: 0.8rem 1rem;
  position: relative;
  flex-shrink: 0;
}

.logo {
  max-height: 58px;
  margin-right: 10px;
}

.chat-title {
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle {
  font-weight: 300;
  font-size: 0.8rem;
  opacity: 0.9;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background-color: white;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  /* Scroll suave en iOS */
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.4;
  position: relative;
  animation: fadeIn 0.3s ease-out;
  font-size: 0.95rem;
  word-wrap: break-word;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  background-color: var(--bg-tertiary);
  color: black;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  margin-right: 25px;
}

.bot-message {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  border-top-left-radius: 4px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.typing-indicator {
  display: inline-flex;
  padding: 10px 14px;
  background-color: var(--light-gray);
  border-radius: 12px;
  align-self: flex-start;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background-color: var(--dark-gray);
  border-radius: 50%;
  margin: 0 2px;
  animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-4px);
  }
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.quick-reply {
  padding: 5px 9px;
  background: #ffffff;
  border: 1px solid #d7d7d7;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
}

.quick-reply:hover {
  background: #f3f3f3;
  border-color: #c5c5c5;
  transform: translateX(2px);
}

.chat-input-container {
  padding: 0.8rem;
  background-color: white;
  border-top: 1px solid var(--light-gray);
  position: relative;
  flex-shrink: 0;
}

.chat-input {
  border: 1px solid var(--light-gray);
  border-radius: 24px;
  padding: 10px 45px 10px 14px;
  resize: none;
  transition: border-color 0.2s;
  min-height: 44px;
  /* Tamaño mínimo para touch */
  max-height: 120px;
  font-size: 0.95rem;
}

.chat-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-dark);
  outline: none;
}

.chat-input-container textarea {
  resize: none;
  overflow: hidden;
  max-height: 120px;
  line-height: 1.5;
}


.send-button {
  position: absolute;
  right: 20px;
  bottom: 17px;
  background-color: rgb(55, 65, 81);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
  touch-action: manipulation;
}

.send-button:hover,
.send-button:active {
  background-color: var(--primary-dark);
}

.send-button:disabled {
  background-color: var(--light-gray);
  color: var(--dark-gray);
  cursor: not-allowed;
}

.reset-button {
  position: absolute;
  right: 70px;
  bottom: 18px;
  background: none;
  border: none;
  color: rgb(55, 65, 81);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 8px;
  touch-action: manipulation;
}

.reset-button:hover,
.reset-button:active {
  color: var(--primary-dark);
}

.accordion-button:not(.collapsed) {
  background-color: rgba(7, 192, 245, 0.1);
  color: var(--primary-color);
}

.accordion-button:focus {
  box-shadow: 0 0 0 0.25rem rgba(7, 192, 245, 0.25);
}

body.dark-mode {
  background-color: #1a202c;
  color: #f1f1f1;
}

body.dark-mode .chat-container {
  background: #2d3748;
  border-color: #4a5568;
}

body.dark-mode .chat-input-container {
  background-color: #2d3748;
}

body.dark-mode .chat-input {
  background-color: var(--primary-color);
  color: #fff;
}

body.dark-mode .chat-body {
  background: #2d3748;
  border-color: #4a5568;
}


.img-avatar {
  background-color: var(--primary-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  padding: 5px;
}

.message {
  margin-left: 0px;
  margin-top: 2px;
}

.btn-cs {
  background-color: var(--primary-dark);
  color: white;
  border: none;
  transition: background-color 0.2s;
}

.bg-user {
  background-color: var(--primary-dark);
}

/* Media Queries para diferentes tamaños */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 20px);
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }

  .chat-header {
    padding: 0.7rem;
  }

  .logo {
    max-height: 55px;
  }

  .chat-body {
    padding: 0.8rem;
  }

  .message {
    max-width: 90%;
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .quick-reply {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  .chat-input-container {
    padding: 0.7rem;
  }

  .chat-input {
    padding: 8px 40px 8px 12px;
  }

  .send-button {
    width: 34px;
    height: 34px;
    right: 18px;
    bottom: 15px;
  }

  .reset-button {
    right: 60px;
    bottom: 18px;
    font-size: 0.8rem;
  }
}

@media (max-width: 576px) {
  .chat-header {
    flex-direction: column;
    text-align: center;
  }

  .logo {
    margin-right: 0;
    margin-bottom: 5px;
    max-width: 150px;
  }

  .message {
    max-width: 95%;
  }

  .reset-button {
    right: 60px;
  }
}

/* Ajustes específicos para iOS */
@supports (-webkit-touch-callout: none) {
  .chat-body {
    padding-bottom: 20px;
    /* Espacio extra para iOS */
  }

  .chat-input {
    font-size: 16px;
    /* Evitar zoom en iOS */
  }
}

/* Ajustes para dispositivos muy pequeños (ej. iPhone 5/SE) */
@media (max-width: 320px) {
  .chat-title {
    font-size: 1rem;
  }

  .chat-subtitle {
    font-size: 0.7rem;
  }

  .message {
    font-size: 0.85rem;
  }
}

/* Opciones dentro del globo del bot */
.message.bot-message .options-inline {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  /* columna */
  gap: 5px;
}

/* Cada opción como bloque clickeable */
.message.bot-message .option-item {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 30px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-bounce);
  animation: fadeInUp 0.5s ease-out forwards;
  opacity: 0;
}

.message.bot-message .option-item:hover {
  background: #f3f3f3;
  border-color: #c5c5c5;
  transform: translateX(2px);
}

/* ✅ Hacer que el globo de bienvenida ocupe el 100% */
.message.bot-message.full-width {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  border-top-left-radius: 4px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

/* ✅ Menú principal en fila dentro del globo full */
.message.bot-message.full-width .options-inline.menu-menu_principal {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  gap: 5px;
  width: 100%;
}

/*Lenguaje*/
/* Selector de idioma */
.language-selector {
  position: relative;
}

.language-selector .btn {
  background-color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: inherit;
  padding: 0.375rem 0.75rem;
  transition: all 0.2s ease;
}

.language-selector .btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.language-selector .dropdown-menu {
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.language-selector .dropdown-item {
  padding: 0.5rem 1rem;
  transition: background-color 0.2s;
}

.language-selector .dropdown-item:hover {
  background-color: #f8f9fa;
}

.language-flag {
  font-size: 1.1rem;
}

.language-name {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Modo oscuro para el selector de idioma */
body.dark-mode .language-selector .btn {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f1f1f1;
}

body.dark-mode .language-selector .btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .language-selector .dropdown-menu {
  background-color: #2d3748;
  color: #f1f1f1;
}

body.dark-mode .language-selector .dropdown-item {
  color: #f1f1f1;
}

body.dark-mode .language-selector .dropdown-item:hover {
  background-color: #4a5568;
}

/* Responsive */
@media (max-width: 768px) {
  .language-selector .btn .language-name {
    display: none;
  }

  .language-selector .btn {
    padding: 0.375rem;
  }

  .language-selector .dropdown-item .language-name {
    display: inline;
  }
}

@media (max-width: 576px) {
  .language-selector {
    margin-left: auto;
    margin-right: 0.5rem;
  }
}

/* ============================
  Panel Expandible (Dashboard)
============================ */

/* Asegurar que la columna del chat es el referente para el botón */
#chatColumn {
  position: relative;
  /* Asegura el anclaje del botón */
  z-index: 2;
  /* Asegura que el chat no se ponga encima del botón cuando se expande */
}

/* Botón que aparece en el borde del chat para mostrar/ocultar el panel */
/* Botón toggle */
.toggle-dashboard-btn {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 1100;
  background: white;
  color: var(--primary-dark);
  border: none;
  padding: 12px 6px;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  transition: left 0.3s ease, transform 0.3s ease;
}

/* Cuando el dashboard está abierto */
#dashboardColumn.visible~#chatColumn .toggle-dashboard-btn {
  left: 280px;
  /* ancho del dashboard */
  transform: translateY(-50%) rotate(180deg);
}


.toggle-dashboard-btn:hover {
  background-color: #d3d3db;
  color: white;
}

#toggleIcon {
  transition: transform 0.3s ease;
  font-size: 1.2rem;
}

.dashboard-hidden #toggleIcon {
  transform: rotate(0deg);
}

/* Clase para ocultar el contenido y reducir el padding */
.dashboard-hidden #dashboardContent {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#dashboardColumn {
  transition: transform 0.3s ease, width 0.3s ease;
}

#dashboardColumn.collapsed {
  transform: translateX(-100%);
  width: 0;
  padding: 0;
  overflow: hidden;
}


/* Modificaciones de dashboard */
/* Añadir/modificar estos estilos */

/* Panel del dashboard - OCULTO por defecto */
#dashboardColumn {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  transform: translateX(-100%);
  opacity: 0;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 280px;
  z-index: 1000;
  overflow-y: auto;
}

.dark-mode #dashboardColumn {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}

#dashboardColumn.visible {
  transform: translateX(0);
  opacity: 1;
  position: absolute;
  /* o directamente NO pongas position acá */
}


/* Cuando el panel está visible, mover el botón */
#dashboardColumn.visible+#chatColumn .toggle-dashboard-btn {
  left: 280px;
  /* Mismo ancho del panel */
  transform: translateY(-50%) rotate(180deg);
}

/* Ajustar el chat cuando el panel está visible */
#chatColumn {
  transition: margin-left 0.3s ease;
}

#dashboardColumn.visible~#chatColumn {
  margin-left: 280px;
  width: calc(100% - 280px);
}

/* Overlay para móviles */
.dashboard-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* Estilos del contenido del dashboard */

.dark-mode .dashboard-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dashboard-section {
  padding: 1rem;
  width: 100%;
}

.dashboard-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #475569;
  text-decoration: none;
  margin-bottom: 2px;
}

.dark-mode .dashboard-item {
  color: #cbd5e1;
}

.dashboard-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #1e40af;
  transform: translateX(4px);
}

.dark-mode .dashboard-item:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.dashboard-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
  border-left: 3px solid #3b82f6;
}

.dark-mode .dashboard-item.active {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

.dashboard-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.dashboard-footer {
  margin-top: auto;
  padding: 1.5rem 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.dark-mode .text-muted {
  color: #94a3b8 !important;
}

/* Responsive */
@media (max-width: 768px) {
  #dashboardColumn {
    position: fixed;
    width: 280px;
    height: 100vh;
    z-index: 1000;
  }

  #dashboardColumn.visible {
    transform: translateX(0);
  }

  #dashboardColumn.visible~#chatColumn .toggle-dashboard-btn {
    left: 280px;
  }

  #dashboardColumn.visible~#chatColumn {
    margin-left: 0;
    width: 100%;
  }

  .dashboard-overlay.active {
    display: block;
  }
}

/* Ajustes para el contenedor principal */
.container-fluid {
  position: relative;
  overflow-x: hidden;
}


@media (max-width: 768px) {
  #dashboardColumn {
    position: fixed;
    height: 100vh;
  }

  .chat-container {
    overflow-y: auto;
    /* Devolvemos el overflow al chat body, no al container */
  }
}

/* Boton claro / oscuro */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-dark) 100%);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.theme-toggle i {
  font-size: 1.25rem;
}

/* Boton selector de idioma */
.lang-toggle {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-dark) 100%);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  transition: all 0.3s ease;
}

.lang-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.lang-toggle i, .lang-toggle span {
  font-size: 1.25rem;
}

/* MARCA: 02/20/2026 14:50:21 */