/* Burbuja flotante */
.thoria-float-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 60px;
    height: 60px;

    /* Elimina padding y borde genéricos */
    padding: 0 !important;
    border: none !important;
    margin: 0 !important;

    /* Fondo: imagen limpia, sin color superpuesto */
    background: transparent
                url('/assets/thoria-avatar.png')
                no-repeat
                center center
                / cover !important;

    /* Resto de tu estilo */
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid rgba(255, 255, 255, 0.9) !important;
}

.thoria-float-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.6);
    border-color: rgba(255, 255, 255, 1) !important;
}

/* Panel deslizable */
.thoria-drawer {
    position: absolute;
    bottom: 0;
    right: 16px;
    width: 380px;
    max-width: 90%;
    height: 0;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(59, 130, 246, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: height 0.4s ease-in-out;
    border: 1px solid #e2e8f0;
    border-bottom: none;
}

.thoria-drawer.open {
    height: 480px; 
}

.thoria-drawer-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    padding: 16px 20px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    border-radius: 20px 20px 0 0;
}

.thoria-drawer-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        rgba(255,255,255,0.1) 25%, 
        transparent 25%, 
        transparent 50%, 
        rgba(255,255,255,0.1) 50%, 
        rgba(255,255,255,0.1) 75%, 
        transparent 75%);
    background-size: 20px 20px;
    pointer-events: none;
}

.thoria-drawer-close {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    z-index: 1;
}

.thoria-drawer-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.thoria-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.thoria-input-area {
    display: flex;
    border-top: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 12px;
    gap: 12px;
}

.thoria-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 12px 18px;
    font-size: 0.9rem;
    outline: none;
    background: #ffffff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    color: #475569;
}

.thoria-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: #f0f9ff;
}

.thoria-input::placeholder {
    color: #94a3b8;
}

.thoria-send {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    padding: 0 16px;
    border: none;
    border-radius: 20px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.thoria-send:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: scale(1.05) translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.thoria-send:active {
    transform: scale(0.95);
}

/* CLASE GENÉRICA PARA OCULTAR */
.hidden { 
    display: none; 
}

.message {
    padding: 12px 16px;
    border-radius: 18px;
    margin-bottom: 12px;
    max-width: 85%;
    position: relative;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.message.user {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 6px;
    position: relative;
}

.message.user::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid #2563eb;
    border-bottom: 8px solid transparent;
}

.message.bot {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: #334155;
    margin-right: auto;
    border-bottom-left-radius: 6px;
    border: 1px solid #e2e8f0;
    position: relative;
}

.message.bot::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid #f8fafc;
    border-bottom: 8px solid transparent;
}

.timestamp {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    display: block;
    margin-top: 6px;
    text-align: right;
    font-weight: 400;
}

.message.bot .timestamp {
    color: #94a3b8;
    text-align: left;
}

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    margin-bottom: 12px;
    max-width: 85%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Efectos de entrada para mensajes */
.message {
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Scrollbar personalizado para el área de mensajes */
.thoria-messages::-webkit-scrollbar {
    width: 6px;
}

.thoria-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.thoria-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 3px;
}

.thoria-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Estados del botón de envío */
.thoria-send:disabled {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Efecto de pulsación para mensajes */
.message:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Mensaje de bienvenida especial */
.welcome-message {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #7dd3fc;
    color: #0c4a6e;
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 500;
    animation: welcomePulse 2s ease-in-out;
}

@keyframes welcomePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(125, 211, 252, 0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 4px 16px rgba(125, 211, 252, 0.5);
    }
}

/* Responsive improvements */
@media (max-width: 768px) {
    .thoria-drawer {
        width: 95%;
        right: 2.5%;
    }
    
    .thoria-float-btn {
        width: 50px;
        height: 50px;
        bottom: 12px;
        right: 12px;
    }
    
    .message {
        max-width: 90%;
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    
    .thoria-input {
        font-size: 0.85rem;
        padding: 10px 16px;
    }
    
    .thoria-send {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
    
    .thoria-drawer-header {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}