/* Botón flotante */
#chat-toggle {
    position: fixed;
    bottom: 170px;
    right: 10px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background-color: #ffffff;
    background: url('../imagenes/chat/IA (2).png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 60%;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
    outline: none;
    z-index: 2147483647;
    opacity: 1 !important;
    background-color: white !important;
}
 
@keyframes pulso {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

#chat-toggle.pulso {
  animation: pulso 1.5s ease-in-out;
}


  /* Icono cuando el chat está abierto */
  #chat-toggle.active {
    background-color: rgb(255, 255, 255);
    background-image: url('../imagenes/chat/IA (1).png'); /* icono de cerrar */
  }

  /* Animación de presionado */
  #chat-toggle:active {
    transform: scale(0.9);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
  }

/* Ventana emergente del chat */
#chat-window {
    position: fixed;
    bottom: 40px;
    right: 77px;
    width: 30vw;
    height: 70vh;
  min-width: 250px;
  min-height: 150px;
  max-width: 600px;
  max-height: 700px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 0 2px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    flex-direction: column;

    /* Oculto por defecto y animable */
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: scale(0.95) translateY(20px);
    resize: both;
    overflow: auto;
        font-family: 'Segoe UI', sans-serif;
    font-size: 16px;
    text-align: left;
    color: #333;
}

#chat-window.show {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

#chat-box {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    font-size: 14px;
}


#chat-input-area {
    display: flex;
    padding: 10px;
}
        
.input-wrapper {
    position: relative;
    width: 100%;
}

#user-input {
    width: 100%;
    padding: 10px 40px 10px 16px; /* Espacio a la derecha para el botón */
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

#user-input:focus {
    border-color: #000000;
}

#send-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: url('../imagenes/chat/send.png') no-repeat center center;
    background-size: contain;
    border: none;
    cursor: pointer;
    padding: 0;
    color: transparent; /* Oculta el texto si lo dejas */
    overflow: hidden;   /* Asegura que no se desborde texto */
}


.mensaje {
    max-width: 75%;
    margin: 8px;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 14px;
    background-color: #ffffff; 
    color: #000000;
  }
  
  .mensaje-usuario {
    background-color: red; 
    color: #ffffff;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 0;
  }
  
  .mensaje-ia {
    background-color: red; 
    color: #ffffff;
    align-self: flex-start;
    margin-right: auto;
    border-bottom-left-radius: 0;
  }
  

.ia-generando {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.atom {
  position: relative;
  width: 26px;   /* 40 * 0.65 */
  height: 26px;
  perspective: 800px;
  transform-style: preserve-3d;
}

.electron {
  position: absolute;
  width: 4px;   /* 6 * 0.65 */
  height: 4px;
  background: cyan;
  border-radius: 50%;
  box-shadow: 0 0 4px #00f2ff;
  animation: spin 2s linear infinite;
}

.electron::before {
  content: '';
  position: absolute;
  width: 39px;   /* 60 * 0.65 */
  height: 39px;
  border-radius: 50%;
  border: 1.5px dashed rgb(0, 0, 0);
  top: -17px;    /* -27 * 0.65 */
  left: -17px;
}

.electron-x {
  transform: rotateX(60deg) translateZ(13px); /* 20 * 0.65 */
  animation-name: spin-x;
}

.electron-y {
  transform: rotateY(60deg) translateZ(13px);
  animation-name: spin-y;
  background: #ff2cff;
  box-shadow: 0 0 4px #ff2cff;
}

.electron-z {
  transform: rotateZ(45deg) translateZ(13px);
  animation-name: spin-z;
  background: #fff960;
  box-shadow: 0 0 4px #fff960;
}

@keyframes spin-x {
  0%   { transform: rotateX(60deg) rotateZ(0deg) translateX(2px); }
  100% { transform: rotateX(60deg) rotateZ(360deg) translateX(2px); }
}

@keyframes spin-y {
  0%   { transform: rotateY(60deg) rotateZ(0deg) translateX(2px); }
  100% { transform: rotateY(60deg) rotateZ(360deg) translateX(2px); }
}

@keyframes spin-z {
  0%   { transform: rotateZ(45deg) rotateZ(0deg) translateX(2px); }
  100% { transform: rotateZ(45deg) rotateZ(360deg) translateX(2px); }
}

.label {
  font-size: 12px; /* también puedes reducir si lo deseas */
  color: #000000;
}


                
.botones-sugerencia {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 8px 12px;
}

.pregunta-sugerida {
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pregunta-sugerida:hover {
    background-color: #e0e0e0;
}

    .botones-sugerencia {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 10px;
    }

    .pregunta-sugerida {
        opacity: 0;
        transform: translateY(10px);
        animation: aparecer 0.4s ease forwards;
        background-color: #f1f1f1;
        border: none;
        padding: 8px 12px;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
        transition: background-color 0.2s ease;
    }

    .pregunta-sugerida:hover {
        background-color: #e0e0e0;
    }

    @keyframes aparecer {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }


        .botones-sugerencia {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 10px;
        }

        .pregunta-sugerida {
            opacity: 0;
            transform: translateY(10px);
            animation: aparecer 0.4s ease forwards;
            background-color: #f1f1f1;
            border: none;
            padding: 8px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            transition: background-color 0.2s ease;
        }

        .pregunta-sugerida:hover {
            background-color: #e0e0e0;
        }

        @keyframes aparecer {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

@media (max-width: 568px) {
  #chat-window {
    bottom: 90px;
    right: 10px;
    width: 90vw;
    height: 70vh;
    max-width: none;
    max-height: none;
    border-radius: 12px;
  }

  #chat-toggle {
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-size: 70%;
  }

  #chat-box {
    font-size: 14px;
  }
  #chat-box {
  -webkit-overflow-scrolling: touch; /* scroll suave en iOS */
}

  #chat-input-area {
    padding: 5px;
  }

  .input-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  #user-input {
    font-size: 14px;
  }

  .pregunta-sugerida {
    font-size: 13px;
    padding: 5px 10px;
    margin: 3px;
  }
}
