/* Chatbot Floating Action Button */
.chatbot-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    color: white;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: float 6s ease-in-out infinite;
}

/* Subtle Pulse Ring */
.chatbot-fab::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(124, 58, 237, 0.5);
    opacity: 0;
    z-index: -1;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-6px);
    }

    100% {
        transform: translateY(0px);
    }
}

.chatbot-fab:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 40px rgba(124, 58, 237, 0.6);
}

/* Message Bubble Hint */
.chatbot-fab::before {
    content: 'Ajuda?';
    position: absolute;
    right: 75px;
    background: white;
    color: #333;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.chatbot-fab:hover::before {
    opacity: 1;
    transform: translateX(0);
}

.chatbot-fab i {
    font-size: 28px;
    transition: transform 0.4s ease;
}

.chatbot-fab:hover i {
    transform: rotate(15deg) scale(1.1);
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.5) translateY(20px) translateX(20px);
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-family: 'Inter', sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chatbot-window.active {
    opacity: 1;
    transform: scale(1) translateY(0) translateX(0);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

/* Header Background Effect */
.chatbot-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    animation: rotate-bg 15s linear infinite;
    pointer-events: none;
}

@keyframes rotate-bg {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-avatar img {
    width: 24px;
    height: auto;
}

.chatbot-info {
    display: flex;
    flex-direction: column;
}

.chatbot-name {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.chatbot-status {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.9;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #4ade80;
    /* Green */
    border-radius: 50%;
    box-shadow: 0 0 5px #4ade80;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.message-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    max-width: 85%;
    animation: fade-in-up 0.3s ease-out forwards;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar-small {
    width: 28px;
    height: 28px;
    background: #E0E7FF;
    color: #4B39D7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

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

.message-wrapper.user .message-content {
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

/* Input Area */
.chatbot-input-area {
    padding: 15px 20px;
    border-top: 1px solid #F1F5F9;
    background-color: white;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E2E8F0;
    border-radius: 25px;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #334155;
    background-color: #F8FAFC;
    transition: all 0.2s;
}

.chatbot-input:focus {
    background-color: white;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chatbot-input::placeholder {
    color: #94A3B8;
}

.chatbot-send-btn {
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.4);
}

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

/* Scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chatbot-fab {
        bottom: 20px;
        right: 20px;
    }
}