/* ============================================================
   💬 CONTENEDOR Y MENSAJES DEL CHAT
   ============================================================ */
.chat-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    padding: 10px 15px;
    background-color: #ffffff;
}

/* Contenedor de mensajes */
.card-chat-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-width: 99%;
    width: 99%;
    margin: 0 auto;
}


/* ============================================================
   💬 BURBUJAS DE MENSAJE Y AJUSTE DE ANCHO DE TEXTO
   ============================================================ */
.chat-container .p-texto-chat-ld,
.chat-container .p-texto-chat-rd {
    padding: 8px 12px !important;
    border-radius: 14px !important;
    font-size: 14px;
    line-height: 1.4;
    max-width: 95%; /* Más ancho: texto fluido */
    white-space: normal; /* Permite saltos naturales */
    word-break: normal; /* No corta palabras abruptamente */
    overflow-wrap: break-word; /* Solo rompe si es necesario */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
}

/* ============================================================
   💭 INDICADOR DE "ESCRIBIENDO..."
   ============================================================ */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 0;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #3e71a7;
    border-radius: 50%;
    display: inline-block;
    margin: 0 3px;
    animation: bounce 1s infinite ease-in-out both;
}

.typing-indicator span:nth-of-type(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-of-type(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}


.chat-fixed #chatbot-toggle2 {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #3e71a7;
    color: white;
    border: none;
    border-radius: 12px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transition: background 0.2s;
    z-index: 9999;
}
.chat-fixed #chatbot-toggle2:hover {
    background: #4d6886;
}

.chat-fixed #chatbot-container {
    position: fixed;
    bottom: 5px;
    right: 20px;
    width: 98.5%;
    max-height: 90vh;
    min-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #ddd;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

/* ✅ Cuando la pantalla es pequeña */
@media (max-width: 768px) {
  .chat-fixed #chatbot-container {
    width: 96%;
    right: 3%;
    bottom: 1%;
    max-height: 99vh;
  }
}

.chat-fixed .chatbot-header {
    background: #3e71a7;
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-fixed .chatbot-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chat-fixed .chatbot-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
}

.chat-fixed .chatbot-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-fixed .message {
    display: flex;
}

.chat-fixed .message.bot {
    justify-content: flex-start;
}

.chat-fixed .message.user {
    justify-content: flex-end;
}

.chat-fixed .bubble {
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 80%;
    font-size: 0.9rem;
    word-wrap: break-word;
}

.chat-fixed .message.bot .bubble {
    background: #e5e7eb;
    color: #1f2937;
    border-bottom-left-radius: 0;
}

.chat-fixed .message.user .bubble {
    background: #0d9488;
    color: white;
    border-bottom-right-radius: 0;
}

.chat-fixed .chatbot-input {
    border-top: 1px solid #ccc;
    padding: 8px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-fixed .chatbot-input textarea {
    flex: 1;
    resize: none;
    border-radius: 8px;
    border: 2px solid #ccc;
    outline: none;
    font-size: 0.9rem;
    max-height: 80px;
    box-shadow: none !important;
    border-radius: 8px 8px 8px 8px;
    padding: 0.6rem 15px;
    border: 1px solid #ced4da;
}

.chat-fixed .chatbot-input textarea:focus {
    border-color: #3e71a7;
    box-shadow: 0 0 0 0.15rem rgba(0, 150, 136, 0.25);
    border: 1px solid #3e71a7 !important;
}

.chat-fixed .chatbot-input button {
    background: #3e71a7;
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    //display: flex;
    //align-items: center;
    //justify-content: center;
    height: 100%;
}

.chat-fixed .chatbot-input button:hover {
    background: #4d6886;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

.chat-fixed .typing {
    display: flex;
    gap: 3px;
    padding: 8px 12px;
    background: #e5e7eb;
    border-radius: 12px;
    max-width: 80%;
    color: #374151;
    border-bottom-left-radius: 0;
}

.chat-fixed .typing .dot {
    animation: bounce 1.4s infinite ease-in-out both;
}

.chat-fixed .typing .dot:nth-child(1) {
    animation-delay: 0s;
}
.chat-fixed .typing .dot:nth-child(2) {
    animation-delay: 0.2s;
}
.chat-fixed .typing .dot:nth-child(3) {
    animation-delay: 0.4s;
}

#containerOpciones .toggle {
    position: relative;
    display: inline-block;
    width: 120px;
    height: 40px;
    background-color: #ccc;
    border-radius: 40px;
    cursor: pointer;
    font-family: sans-serif;
    overflow: hidden;
    transition: background-color 0.3s;
}

#containerOpciones .toggle input {
    display: none;
}

#containerOpciones .slider {
    position: absolute;
    inset: 0;
    border-radius: 40px;
    background-color: #3e71a78f;
    transition: background-color 0.3s;
}

#containerOpciones .slider::before {
    content: "IrAGeneral";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
}

#containerOpciones input:checked + .slider {
    background-color: var(--cremil-red);
}

#containerOpciones input:checked + .slider::before {
    content: "IrASencillo";
}


/*Estilos del chat*/

.fa-chat-icon-r{
  font-size: 1.5rem;
  padding-left: 0.5em;
  color: #3e71a7;
}

.fa-chat-icon-l{
  font-size: 1.5rem;
  padding-right: 0.5em;
  color: #858991;
}

.p-texto-chat-r{
  border-radius: 15px;
}

.p-texto-chat-rd{
  border-radius: 0px 20px 20px 35px;
  background: #e5e7eb;
  color: #1f2937;
  display: inline-block;
  font-size: 0.9rem;
}

.p-texto-chat-l{
  border-radius: 15px;
  text-align: right;
  direction: ltr;
}

.p-texto-chat-ld{
  border-radius: 20px 0px 35px 20px;
  background: #3e71a7;
  color: white;
  display: inline-block;
  font-size: 0.9rem;
  text-align: start;
}

.input-pregunta{
  border:1px solid rgba(0, 0, 0, 0.125);
  padding: 1em;
  height: 3em;
  color: #000;
  border-radius: 1em;
  font-size: 1.1em;
}

.input-pregunta:focus{
  color: #495057;
  background-color: #FFF;
  border-color: rgba(0, 0, 0, 0.325);
  outline: 0;
  -webkit-box-shadow: none;
  box-shadow: none;
}

.input-pregunta.disabled{
  background-color: #e9ecef;
  opacity: 1;
}

.card-chat{
  border-radius: 15px;
}

.card-chat-mensajes{
  height:60vh;
  overflow-y:scroll;
}

.chat-img-load{
  width: 2em;
}

.ia-ver-mas{
  color: black;
  font-weight: bold;
  cursor: pointer;
}

.ia-ver-mas:hover{
  color:gray;
}

.chat-item{
  opacity: 0;
  filter: brightness(0.6);
  transition: opacity 0.6s ease, filter 0.6s ease;
}

.chat-item.visible{
  opacity: 1;
  filter: brightness(1);
}

.chat-item-user{
  opacity: 0;
  filter: brightness(0.6);
  transition: opacity 0.6s ease, filter 0.6s ease;
}

.chat-item-user.visible{
  opacity: 1;
  filter: brightness(1);
}

.wait_message{
    padding:0.3rem !important;
    border-radius: 0 10px 10px 25px !important;
}

.modal-dialog.modal-xxl{
  max-width: 90%;
}


.main-content{
    margin-top: 0px !important;
}


.grafica_view{
    margin-bottom: 10px;
}
.grafica_view canvas{
    height:350px !important;
    padding: 1px;
    box-shadow: rgb(62, 113, 167) 2px 1px 5px 0px;
}

#divLoading {
    position: fixed;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9999;
}

.gema_chat{
    width: 25px;
    height: 30px;
    padding-right: 5px;
}


.chatbot-toggle {
    border: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #fff;
    text-decoration: none;
    font-family: Arial, sans-serif;
    font-size: 15px;
    z-index: 999;
    cursor:pointer;
    background:none;
    animation: waTada 3s infinite ease-in-out;
}

.chatbot-toggle:hover .wa-icon, .chatbot-toggle:hover .wa-text {
    background: #2f6fb2;
}

.chatbot-toggle:hover{
    animation: none;
    transform: scale(1);
}

.chatbot-toggle:hover * {
    animation-play-state: paused;
    animation: none;
    transform: scale(1);
}

/* Espacio entre animaciones */
@keyframes waTada {
    0% {
        transform: scale3d(1, 1, 1);
    }
    3.3%, 6.6% {
        transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
    }
    9.9%, 16.5%, 23.1%, 29.7% {
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
    }
    13.2%, 19.8%, 26.4% {
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
    }
    33% {
        transform: scale3d(1, 1, 1);
    }

    /* Pausa hasta completar los 3s */
    100% {
        transform: scale3d(1, 1, 1);
    }
}

/* Icono */
.wa-icon {
    width: 50px;
    height: 50px;
    background: #000;//#2f6fb2;
    border-radius: 50%;
    padding:15px;
    /* CENTRAR ÍCONO */
    display: flex;
    align-items: center;
    justify-content: center;

    animation: iconGlow 3s infinite ease-in-out;
}

.wa-icon:hover{
    animation: none;
    transform: scale(1);
}

.wa-icon i {
    font-size: 20px;
    color: #fff;
    line-height: 1;
}

.wa-text {
    font-size: 15px;
    white-space: nowrap;
    background: #000; #2f6fb2;
    box-shadow: 0 4px 10px rgba(0,0,0,.25);
    padding:15px;
    border-radius: 30px;

    animation: textGlow 3s infinite ease-in-out;
}

.wa-text:hover{
    animation: none;
    transform: scale(1);
}

/* ANIMACIÓN TEXTO */
@keyframes textGlow {
  0% {
    box-shadow: 0 0 0 rgba(44,111,178,0);
    transform: scale(1);
  }

  30% {
    box-shadow: 0 0 18px rgba(44,111,178,.9);
    transform: scale(1.05);
  }

  33%, 100% {
    box-shadow: 0 0 0 rgba(44,111,178,0);
    transform: scale(1);
  }
}

/* ANIMACIÓN ICONO */
@keyframes iconGlow {
    0% {
        box-shadow: 0 0 0 rgba(44,111,178,0);
        transform: scale(1);
    }

    30% {
        box-shadow: 0 0 18px rgba(44,111,178,.9);
        transform: scale(1.05);
    }

    33%, 100% {
        box-shadow: 0 0 0 rgba(44,111,178,0);
        transform: scale(1);
    }
}