/* Widget de Chat Flotante */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050; /* Aumentado de 1000 a 1050 */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    font-size: 24px;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
}

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

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 4px;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 8px;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid #e1e5e9;
    background: white;
}

.chat-input-form {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    border: 1px solid #e1e5e9;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
    min-height: 20px;
    max-height: 80px;
}

.chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send:hover {
    transform: scale(1.05);
}

.chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.typing-indicator {
    display: none;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 1px solid #e1e5e9;
    max-width: 80%;
}

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

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

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

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

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

/* Responsivo */
@media (max-width: 768px) {
    .chat-container {
        width: 300px;
        height: 450px;
        bottom: 70px;
        right: -10px;
    }
    
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    /* Ajustar posición cuando hay botón de filtro */
    .float-filter-button ~ .chat-widget {
        bottom: 80px; /* Mover el chat más arriba cuando hay filtro */
    }
}

@media (max-width: 480px) {
    .chat-container {
        width: calc(100vw - 40px);
        height: 400px;
        right: -15px;
    }
    
    .chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    /* Ajustar posición en móviles cuando hay botón de filtro */
    .float-filter-button ~ .chat-widget {
        bottom: 75px;
    }
}