/* General settings */
body {
  font-family: "Inter", "Open Sans", sans-serif;
  font-size: 13px;
  background-color: #f6f6f9;
  color: #3e3e3e;
  margin: 0;
  padding: 0;
}

.left-panel iframe {
  background: #f6f6f9;
}

/* Right panel (chat) */
.right-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-left: 1px solid #e5e5e5;
  background-color: #ffffff;
}

/* Chat header */
.chat-header {
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

/* Tabs look */
.nav-tabs .nav-link {
  color: #666;
  font-weight: 500;
  font-size: 13px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
}

.nav-tabs .nav-link.active {
  color: #006b8f; /* Mismo color que el botón */
  border-bottom: 2px solid #006b8f;
  background-color: transparent;
}


.chat-tabs {
  padding: 0 1rem;
}

/* Chat message container */
.chat-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #fafafa;
}

/* Chat box */
.chat-box {
  display: flex;
  flex-direction: column;
  width: 100%; /* forzamos a usar todo el espacio */
}

.chat-message {
  margin-bottom: 0.8rem;
}

.chat-message.user {
  text-align: right;
}

.chat-message.ai {
  text-align: left;
}

.chat-message p {
  background: #ebebeb;
  color: #333;
  border-radius: 14px;
  padding: 0.6rem 0.9rem;
  font-size: 13px;
  line-height: 1.5;
  max-width: 100%;
  display: inline-block;
  position: relative;
}

/* Differentiate User vs AI */
.chat-message.user p {
  background: #d1e7dd;
  color: #155724;
}

/* Input and Button */
.chat-input {
  padding: 0.8rem 1rem;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  background: #ffffff;
}

.chat-input .form-control {
  background: #fefefe;
  border: 1px solid #cccccc;
  font-size: 13px;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  height: 38px;
}

.chat-input button {
  font-size: 13px;
  border-radius: 6px;
  background-color: #0d6efd;
  color: white;
  padding: 0.4rem 1rem;
  height: 38px;
}

.chat-input button:hover {
  background-color: #0b5ed7;
}

/* Disclaimer footer */
.chat-disclaimer {
  font-size: 9px;
  color: #888;
  text-align: center;
  padding: 0.2rem;
  background-color: #fafafa;
  border-top: 1px solid #eee;
  margin: 0; /* Eliminar todos los márgenes */
  position: relative; /* Asegurar posición correcta */
  top: -1px; /* Ajustar ligeramente hacia arriba */
  display: block;
}

/* Scrollbar for chat */
.chat-content::-webkit-scrollbar {
  width: 6px;
}
.chat-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}
.chat-content::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.btn-ai {
  background: transparent;
  border: none;
  padding: 0;
  height: 38px;
  width: 38px;
  cursor: pointer;
}

.btn-ai img {
  display: block;
}
.chat-input-wrapper {
  padding: 0.5rem 1rem;
  border-top: 1px solid #eee;
  background-color: #fff;
}

.chat-input-container {
  position: relative;
  width: 100%;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin: 0;
  padding: 0;
  display: block; /* Asegurarse que es un bloque */
  overflow: visible; /* Para evitar cortes */
}

.chat-textarea {
  width: 100%;
  resize: none;
  padding: 0.75rem 0.75rem 2.25rem 1rem;  /* Espacio para el botón */
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 0px;
  background-color: #fefefe;
  height: 120px; /* Reducir altura si es posible */
  box-sizing: border-box;
  transition: box-shadow 0.3s ease, border 0.3s ease;
  margin-bottom: 0; /* Eliminar margen inferior */
  display: block;
}

.btn-send {
  position: absolute;
  right: 10px;
  bottom: 24px;
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  color: #006b8f;
  background-color: #e6f1f6;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  transition: background 0.3s ease;
}

.btn-send:hover {
  background-color: #cfe9f1;
  color: #004d66;
}

.typing-indicator {
  font-size: 14px;
  color: #006b8f; /* Texto azul */
  background-color: #e6f7ff; /* Fondo azul claro */
  padding: 5px 10px;
  border-radius: 6px;
  margin-top: 5px;
  text-align: right;
  display: inline-block;
}

.chat-message.ai .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #ccc;
  border-top-color: #006b8f;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.chat-placeholder {
  color: #888;
  font-size: 14px;
  text-align: center;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .left-panel {
    display: none; /* Oculta el dashboard en pantallas pequeñas */
  }

  .right-panel {
    width: 100%;
  }

  .chat-input-wrapper {
    padding: 1rem;
  }
}
.login-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.login-container h2 {
  text-align: center;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 15px;
}

.btn {
  width: 100%;
}

.btn-flat {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-flat:focus {
    outline: none;
}

.btn-flat svg {
    transition: transform 0.2s ease;
}

.btn-flat:hover svg {
    transform: scale(1.1);
}

.btn-reload {
    background: none;
    border: none;
    padding: 0;
    margin-left: 10px; /* Espacio entre el botón y el texto "Online" */
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-reload svg {
    width: 16px;
    height: 16px;
    stroke: black;
    transition: transform 0.2s ease;
}

.btn-reload:hover svg {
    transform: scale(1.1); /* Efecto de hover */
}

.btn-reload:focus {
    outline: none;
}

.loading-message {
    text-align: center;
    margin-top: 20px;
}

.loading-message .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 10px;
}

.loading-message p {
    font-size: 14px;
    color: #006b8f;
    font-weight: 500;
}

/* Colores pastel para los niveles de riesgo */
.bg-danger-pastel {
    background-color: #f8d7da; /* Rojo pastel */
    color: #842029;
}

.bg-warning-pastel {
    background-color: #fff3cd; /* Amarillo pastel */
    color: #664d03;
}

.bg-success-pastel {
    background-color: #d1e7dd; /* Verde pastel */
    color: #0f5132;
}

/* Ajustes de padding y bordes */
.alert {
    border: 1px solid transparent;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    margin-right: 2%;
    margin-left: 2%;
    margin-top: 1rem;
}

.alert p {
    margin: 0;
    padding: 0;
}

.spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Hacer que el botón de AI encaje mejor con el tamaño reducido */
.btn-sm {
    font-size: 0.775rem;
    padding: 0.25rem 0.5rem;
}

/* SOLO ESTAS REGLAS PARA LOS SELECTORES DE CONTEXTO */

/* Estilo mínimo para la sección de selectores de contexto */
.context-selector {
  background-color: #fafafa;
  width: 100%;
  padding: 0.25rem !important;
}

/* Estilo para los botones de dropdown en estado hover */
.context-selector .btn:hover {
  background-color: #f8f9fa;
}
.selector-principal {
  border-left: 6px solid rgb(51, 117, 179); /* Azul más claro para coincidir con la imagen */
}
/* Estilos para el selector Contexto (verde) */
.selector-contexto {
  border-left: 6px solid rgb(48, 110, 72);
}

/* Contenedor de selector con borde lateral */
.selector-container {
  position: relative;
  border-left: 6px solid transparent;
}
.w-95 {
  width: 95%;
  margin-left: auto;
  margin-right: auto;
}
.selector-with-border .btn {
  margin-left: -1px;
  padding-left: 10px;
}
/* Estilos específicos para cada selector */

/* Estilos base para ambos selectores */
.principal-item, .context-item {
    position: relative;
}

/* Estilo para los bordes laterales usando pseudo-elementos */
.principal-item::before, .context-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px; /* Grosor de la línea */
    z-index: 1;
}

/* Eliminar cualquier margen o padding que pueda afectar */
.dropdown {
    padding-left: 0;
}

/* Agregar padding al botón para compensar la línea */
.principal-item .btn, .context-item .btn {
    padding-left: 12px;
}

/* Estilo para el dropdown */
.dropdown-menu {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Asegurar que las opciones del dropdown sean del tamaño correcto */
.dropdown-item.small {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
}

/* Asegurarnos que el dropdown superior tenga margen inferior */
.context-selector .dropdown:first-child {
  margin-bottom: 0.5rem;
}

/* Asegurar que los dropups funcionen correctamente */
.dropup .dropdown-menu {
  bottom: 100%;
  top: auto;
  margin-top: 0;
  margin-bottom: 0.125rem;
}

/* Ajuste para dropdown-menu */
.dropdown-menu {
  padding: 0.25rem 0;
  max-height: 200px;
  overflow-y: auto;
}
/* Estilo para los checkboxes en el selector de contexto */
.context-selector .form-check {
  padding-left: 1.8rem;
}

.context-selector .form-check-input {
  margin-left: -1.5rem;
}

/* Estilos específicos para los selectores principal y contexto */

/* Estilo para cuando un checkbox está seleccionado */
.context-selector .form-check-input:checked + .form-check-label {
  color: rgb(48, 110, 72);
  font-weight: 500;
}

/* Color de fondo personalizado para los elementos activos en los dropdowns */
.dropdown-item.active, 
.dropdown-item:active {
  background-color: rgba(51, 117, 179, 0.1) !important;
  color: rgb(51, 117, 179) !important;
  font-weight: 500;
}

/* Estilo para los checkboxes */
.context-selector .form-check-input:checked {
  background-color: rgb(48, 110, 72);
  border-color: rgb(48, 110, 72);
}

.context-selector .form-check-input:focus {
  border-color: rgba(48, 110, 72, 0.5);
  box-shadow: 0 0 0 0.25rem rgba(48, 110, 72, 0.25);
}

/* Estilo para texto cuando no hay contexto seleccionado */
#selectedContextsText.text-muted {
  font-style: italic;
  color: #6c757d !important;
  font-weight: normal;
}

/* Estilo para texto cuando no hay tabla principal seleccionada */
#selectedMainText.text-muted {
  font-style: italic;
  color: #6c757d !important;
  font-weight: normal;
}

/* Estilos para los bloques de código y SQL */

.code-block {
  position: relative;
  margin: 10px 0;
  background-color: #f8f9fa;
  border: 1px solid #eaecef;
  border-radius: 3px;
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background-color: #f1f3f5;
  border-bottom: 1px solid #eaecef;
  font-size: 12px;
  color: #6c757d;
}

.btn-copy {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  color: #6c757d;
  border-radius: 3px;
  transition: all 0.2s;
}

.btn-copy:hover {
  background-color: #e9ecef;
  color: #0d6efd;
}

.code, .sql-code {
  padding: 10px;
  margin: 0;
  overflow-x: auto;
  font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre;
}

.sql-block .sql-code {
  color: #a31515; /* Color para SQL */
}

/* Mensaje de fuente */
.message-source {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 5px;
  margin-top: 8px;
  font-size: 11px;
  color: #6c757d;
}

/* Añadir estos estilos para el indicador de "pensando" de Claude */

.thinking-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
}

.thinking-text {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 8px;
}

.thinking-dots {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.dot {
  height: 8px;
  width: 8px;
  margin: 0 4px;
  background-color: #ced4da;
  border-radius: 50%;
  opacity: 0.6;
  transition: all 0.3s ease;
}

.dot.active {
  background-color: #0d6efd;
  opacity: 1;
  transform: scale(1.2);
}

.thinking-progress-container {
  width: 100%;
  height: 4px;
  background-color: #e9ecef;
  border-radius: 2px;
  overflow: hidden;
}

.thinking-progress-bar {
  height: 100%;
  width: 0%;
  background-color: #0d6efd;
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* Estilo mejorado para el mensaje de loading */
.message.ai-message.loading {
  background-color: #f8f9fa;
  border-color: #e9ecef;
}

/* Añadir estos estilos al final del archivo */

/* Estilos para la visualización de datos */
.data-container {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  overflow-x: auto;
  max-width: 100%;
}

.data-display {
  min-height: 200px;
  max-height: 500px;
  width: 100%;
}

.sql-query {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 10px;
  position: relative;
}

.sql-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  font-weight: bold;
  color: #495057;
}

.copy-sql-btn {
  padding: 2px 8px;
  font-size: 0.75rem;
}

/* Estilos para tablas */
.table {
  width: 100%;
  margin-bottom: 0;
  color: #212529;
  font-size: 0.9rem;
}

.table th {
  position: sticky;
  top: 0;
  background-color: #495057;
  color: white;
  font-weight: 600;
  z-index: 2;
}

.table-responsive {
  max-height: 400px;
  overflow-y: auto;
}

.truncated-info {
  margin-top: 5px;
  font-style: italic;
  text-align: right;
}

/* Estilos para gráficos */
canvas {
  max-height: 400px;
  width: 100% !important;
}

/* Mejoras para bloques de código */
.code-wrapper {
  position: relative;
}

.copy-button {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 2px 8px;
  font-size: 0.75rem;
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.copy-button:hover {
  opacity: 1;
}
