/**
 * Estilos para el área pública
 */

/* Contenedor principal */
.asistente-ia-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: var(--asistente-ia-font-family, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

/* Botón flotante */
.asistente-ia-boton {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--asistente-ia-color-primario, #0073aa);
    color: var(--asistente-ia-color-secundario, #ffffff);
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 0;
}

.asistente-ia-boton-contenido {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
}

.asistente-ia-boton::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--asistente-ia-color-primario, #0073aa);
    opacity: 0.2;
    transform: scale(1);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.2;
    }
    70% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.asistente-ia-boton:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.asistente-ia-boton.oculto {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

/* Tooltip personalizado */
.asistente-ia-tooltip {
    position: absolute;
    left: calc(100% + 16px);
    top: calc(50% - 15px);
    height: 32px;
    max-width: 220px;
    padding: 0 14px;
    border: none;
    border-radius: 16px;
    background: #fff;
    color: rgba(0, 0, 0, 0.8);
    line-height: 31px;
    white-space: nowrap;
    opacity: 0;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.4));
    transition: opacity .3s ease-out .4s;
    pointer-events: none;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--asistente-ia-font-family, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.asistente-ia-tooltip::before {
    content: "";
    position: absolute;
    top: 50%;
    right: -6px;
    margin-top: -6px;
    border: 6px solid transparent;
    border-left-color: #fff;
}

.asistente-ia-boton:hover .asistente-ia-tooltip {
    opacity: 1;
}

/* Ventana de chat */
.asistente-ia-chat {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 350px;
    height: 500px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    opacity: 0;
    transform-origin: bottom left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
    font-family: var(--asistente-ia-font-family, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.asistente-ia-chat.visible {
    transform: scale(1);
    opacity: 1;
}

/* Cabecera del chat */
.asistente-ia-chat-header {
    padding: 15px 20px;
    background-color: var(--asistente-ia-color-primario, #0073aa);
    color: var(--asistente-ia-color-secundario, #ffffff);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.asistente-ia-chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.asistente-ia-chat-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--asistente-ia-font-family, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    position: relative;
    top: 2px;
    color: var(--asistente-ia-color-secundario, #ffffff);
}

.asistente-ia-chat-cerrar {
    background: none;
    border: none;
    color: var(--asistente-ia-color-secundario, #ffffff);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: all 0.2s ease;
    border-radius: 50%;
    height: 30px;    
}

.asistente-ia-chat-cerrar:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Cuerpo del chat con mensajes */
.asistente-ia-chat-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Estilos de mensajes */
.asistente-ia-mensaje {
    margin-bottom: 10px;
    max-width: 85%;
    display: flex;
    flex-direction: column;
}

.asistente-ia-mensaje-asistente {
    align-self: flex-start;
}

.asistente-ia-mensaje-usuario {
    align-self: flex-end;
}

.asistente-ia-mensaje-error {
    align-self: center;
    max-width: 100%;
}

.asistente-ia-mensaje-contenido {
    padding: 12px 16px;
    border-radius: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.4;
    font-size: 14px;
}

.asistente-ia-mensaje-asistente .asistente-ia-mensaje-contenido {
    background-color: #ffffff;
    color: #2c3e50;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.asistente-ia-mensaje-usuario .asistente-ia-mensaje-contenido {
    background-color: var(--asistente-ia-color-primario, #0073aa);
    color: var(--asistente-ia-color-secundario, #ffffff);
    border-bottom-right-radius: 5px;
}

.asistente-ia-mensaje-error .asistente-ia-mensaje-contenido {
    background-color: #fee2e2;
    color: #991b1b;
    border-radius: 10px;
    font-size: 13px;
}

/* Indicador de escritura */
.asistente-ia-typing-indicator .asistente-ia-mensaje-contenido {
    display: flex;
    align-items: center;
    padding: 10px 20px;
}

.asistente-ia-typing-indicator .asistente-ia-mensaje-contenido span {
    height: 8px;
    width: 8px;
    background-color: #666;
    border-radius: 50%;
    display: inline-block;
    margin: 0 1px;
    opacity: 0.4;
    animation: asistente-ia-typing 1s infinite;
}

.asistente-ia-typing-indicator .asistente-ia-mensaje-contenido span:nth-child(1) {
    animation-delay: 0s;
}

.asistente-ia-typing-indicator .asistente-ia-mensaje-contenido span:nth-child(2) {
    animation-delay: 0.2s;
}

.asistente-ia-typing-indicator .asistente-ia-mensaje-contenido span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes asistente-ia-typing {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-5px);
        opacity: 0.8;
    }
}

/* Formulario */
.asistente-ia-chat-form {
    padding: 15px 20px;
    border-top: 1px solid #edf2f7;
    background-color: #fff;
}

.asistente-ia-chat-input-container {
    display: flex;
    position: relative;
    margin-bottom: 10px;
}

.asistente-ia-chat-input {
    width: calc(100% - 30px);
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    min-height: 40px;
    max-height: 100px;
    overflow-y: auto;
    outline: none;
}

.asistente-ia-chat-input:focus {
    border-color: var(--asistente-ia-color-primario);
}

.asistente-ia-chat-input::placeholder {
    color: #94a3b8;
}

.asistente-ia-actions {
    display: flex;
    align-items: flex-end;
    margin-left: 10px;
}

.asistente-ia-chat-enviar {
    background-color: var(--asistente-ia-color-primario);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0;
}

.asistente-ia-chat-enviar:hover {
    background-color: var(--asistente-ia-color-primario);
    opacity: 0.9;
}

.asistente-ia-chat-enviar svg {
    width: 18px;
    height: 18px;
    transform: translateX(1px);
    position: relative;
    top: -1px;
    color: #fff;
    fill: currentColor;
    display: inline-block;
}

.asistente-ia-chat-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 5px;
}

.asistente-ia-chat-footer small {
    color: #999;
    font-size: 12px;
}

.asistente-ia-upload-btn {
    background-color: #f1f1f1;
    color: #555;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-right: 8px;
}

.asistente-ia-upload-btn:hover {
    background-color: #e0e0e0;
}

/* Estilos para la vista previa de imagen */
.asistente-ia-preview-container {
    margin-bottom: 10px;
}

.asistente-ia-image-preview {
    position: relative;
    display: inline-block;
    max-width: 150px;
    margin-right: 10px;
}

.asistente-ia-image-preview img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.asistente-ia-remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ff5252;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

/* Estilos para mensajes con imágenes */
.asistente-ia-mensaje-imagen {
    margin-bottom: 5px;
}

.asistente-ia-mensaje-imagen img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
}

.asistente-ia-mensaje-texto {
    margin-top: 5px;
}

/* Estilos responsivos */
@media (max-width: 480px) {
    .asistente-ia-chat {
        width: calc(100% - 40px);
        height: 60vh;
        bottom: 10px;
        left: 10px;
        right: 10px;
    }
    
    .asistente-ia-boton {
        min-width: unset;
        width: auto;
        max-width: calc(100% - 20px);
        height: 45px;
        padding: 0 15px;
        bottom: 10px;
        left: 10px;
    }
    
    .asistente-ia-boton-contenido {
        font-size: 13px;
    }
    
    .asistente-ia-boton-contenido svg {
        width: 18px;
        height: 18px;
    }
    
    .asistente-ia-tooltip {
        max-width: calc(100vw - 90px);
    }
} 