/* ============================================
   CHATBOT WIDGET - MEGABYTE TECNOLOGIA
   ============================================ */

/* Botão Toggle do Chat */
.chat-toggle {
    position: fixed;
    bottom: 70px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--color-cyan), var(--color-green-security));
    color: var(--color-dark-blue);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    transition: var(--transition-normal);
    animation: pulse-chat 2s ease-in-out infinite;
}

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

.chat-toggle.chat-hidden {
    display: none;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: bounce-badge 1s ease-in-out infinite;
}

@keyframes pulse-chat {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(0, 212, 255, 0.7);
    }
}

@keyframes bounce-badge {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Widget do Chat */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: var(--color-white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
    transition: all 0.3s ease;
}

.chat-widget.chat-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header do Chat */
.chat-header {
    background: linear-gradient(135deg, var(--color-dark-blue), var(--color-blue-tech));
    color: var(--color-white);
    padding: 1rem 1.25rem;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.chat-header-text h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-status {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--color-green-security);
    border-radius: 50%;
    display: inline-block;
    animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-minimize,
.chat-close {
    background: transparent;
    border: none;
    color: var(--color-white);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.chat-minimize:hover,
.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Body do Chat */
.chat-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f5f7fa;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Mensagens */
.chat-message {
    display: flex;
    margin-bottom: 0.5rem;
    animation: fadeInMessage 0.3s ease;
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-content {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 80%;
}

.chat-message-user .chat-message-content {
    flex-direction: row-reverse;
    margin-left: auto;
}

.chat-avatar-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-cyan), var(--color-green-security));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-dark-blue);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.chat-avatar-small.user {
    background: var(--color-blue-tech);
    color: var(--color-white);
}

.chat-message-text {
    background: var(--color-white);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chat-message-user .chat-message-text {
    background: linear-gradient(135deg, var(--color-cyan), var(--color-green-security));
    color: var(--color-dark-blue);
}

.chat-message-text p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-gray-dark);
}

.chat-message-user .chat-message-text p {
    color: var(--color-dark-blue);
    font-weight: 500;
}

.chat-message-time {
    font-size: 0.7rem;
    color: var(--color-gray);
    margin-top: 0.25rem;
    display: block;
}

.chat-message-user .chat-message-time {
    color: rgba(10, 25, 41, 0.7);
}

/* Indicador de Digitação */
.chat-typing {
    padding: 1rem 1.25rem;
}

.typing-indicator {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--color-cyan);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

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

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

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

/* Footer do Chat */
.chat-footer {
    padding: 1rem;
    background: var(--color-white);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0 0 20px 20px;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
    font-family: var(--font-primary);
}

.chat-input:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.chat-send {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--color-cyan), var(--color-green-security));
    color: var(--color-dark-blue);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 212, 255, 0.4);
}

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

/* Responsividade */
@media (max-width: 768px) {
    .chat-widget {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 10px;
        right: 10px;
        border-radius: 15px;
    }

    .chat-toggle {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }

    .chat-header {
        border-radius: 15px 15px 0 0;
    }

    .chat-footer {
        border-radius: 0 0 15px 15px;
    }
}

@media (max-width: 576px) {
    .chat-widget {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-header {
        border-radius: 0;
    }

    .chat-footer {
        border-radius: 0;
    }

    .chat-message-content {
        max-width: 85%;
    }
}

/* Ajuste quando o botão voltar ao topo está visível */
.back-to-top.show ~ .chat-toggle {
    bottom: 90px;
}

@media (max-width: 768px) {
    .back-to-top.show ~ .chat-toggle {
        bottom: 75px;
    }
}





