/* ==========================================================================
   CHATBOT MADETECH - Assistente Virtual de Vendas
   Design: Glassmorphism + Identidade Visual Madetech
   ========================================================================== */

:root {
    --chatbot-primary: #025fb1;
    --chatbot-primary-light: #1a73c2;
    --chatbot-primary-dark: #014a8f;
    --chatbot-bg: rgba(255, 255, 255, 0.98);
    --chatbot-shadow: 0 25px 50px -12px rgba(2, 95, 177, 0.25);
    --chatbot-shadow-lg: 0 10px 15px -3px rgba(2, 95, 177, 0.1);
    --chatbot-border-radius: 1rem;
    --chatbot-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   BOTÃO FLUTUANTE
   ========================================================================== */

.chatbot-button {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
    cursor: pointer;
    z-index: 10000;
    box-shadow: var(--chatbot-shadow);
    transition: var(--chatbot-transition);
    border: none;
    animation: chatbot-pulse 2s infinite;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 30px 60px -15px rgba(2, 95, 177, 0.35);
}

.chatbot-button.active {
    transform: scale(0.9);
}

/* Animação de pulso */
@keyframes chatbot-pulse {
    0%, 100% {
        box-shadow: 0 25px 50px -12px rgba(2, 95, 177, 0.25), 0 0 0 0 rgba(2, 95, 177, 0.4);
    }
    50% {
        box-shadow: 0 25px 50px -12px rgba(2, 95, 177, 0.25), 0 0 0 15px rgba(2, 95, 177, 0);
    }
}

/* Badge de notificação */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #d13438;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    animation: chatbot-badge-bounce 0.5s ease-in-out;
}

@keyframes chatbot-badge-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ==========================================================================
   JANELA DE CHAT
   ========================================================================== */

.chatbot-window {
    position: fixed;
    bottom: 110px;
    left: 2rem;
    width: 400px;
    max-width: calc(100vw - 4rem);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: var(--chatbot-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--chatbot-border-radius);
    box-shadow: var(--chatbot-shadow);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(2, 95, 177, 0.1);
    animation: chatbot-slide-up 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.chatbot-window.active {
    display: flex;
}

@keyframes chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header do Chat */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--chatbot-border-radius) var(--chatbot-border-radius) 0 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.chatbot-header-text p {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: chatbot-status-pulse 2s infinite;
}

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

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: var(--chatbot-transition);
}

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

/* ==========================================================================
   ÁREA DE MENSAGENS
   ========================================================================== */

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(180deg, rgba(2, 95, 177, 0.02) 0%, rgba(255, 255, 255, 0) 100%);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(2, 95, 177, 0.05);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(2, 95, 177, 0.3);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(2, 95, 177, 0.5);
}

/* Mensagem individual */
.chatbot-message {
    display: flex;
    gap: 0.75rem;
    animation: chatbot-message-slide 0.3s ease-out;
}

@keyframes chatbot-message-slide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.user {
    flex-direction: row-reverse;
}

.chatbot-message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.chatbot-message.bot .chatbot-message-avatar {
    background: linear-gradient(135deg, var(--chatbot-primary-light) 0%, var(--chatbot-primary) 100%);
    color: white;
}

.chatbot-message.user .chatbot-message-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.chatbot-message-content {
    max-width: 75%;
}

.chatbot-message-bubble {
    padding: 0.875rem 1.125rem;
    border-radius: 1.125rem;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message.bot .chatbot-message-bubble {
    background: linear-gradient(135deg, rgba(2, 95, 177, 0.08) 0%, rgba(2, 95, 177, 0.05) 100%);
    border: 1px solid rgba(2, 95, 177, 0.1);
    border-radius: 1.125rem 1.125rem 1.125rem 0.25rem;
    color: #1e293b;
}

.chatbot-message.user .chatbot-message-bubble {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    border-radius: 1.125rem 1.125rem 0.25rem 1.125rem;
}

.chatbot-message-time {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.375rem;
    padding: 0 0.5rem;
}

.chatbot-message.user .chatbot-message-time {
    text-align: right;
}

/* ==========================================================================
   BOTÕES DE OPÇÕES RÁPIDAS
   ========================================================================== */

.chatbot-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    animation: chatbot-options-fade 0.4s ease-out;
}

@keyframes chatbot-options-fade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-option-btn {
    background: white;
    border: 2px solid rgba(2, 95, 177, 0.2);
    padding: 0.875rem 1.125rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--chatbot-transition);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--chatbot-primary);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 2px 4px rgba(2, 95, 177, 0.05);
}

.chatbot-option-btn:hover {
    background: linear-gradient(135deg, rgba(2, 95, 177, 0.05) 0%, rgba(2, 95, 177, 0.08) 100%);
    border-color: var(--chatbot-primary);
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(2, 95, 177, 0.15);
}

.chatbot-option-btn i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ==========================================================================
   INDICADOR DE DIGITAÇÃO
   ========================================================================== */

.chatbot-typing {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.chatbot-typing.active {
    display: flex;
}

.chatbot-typing-dots {
    display: flex;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    background: rgba(2, 95, 177, 0.08);
    border-radius: 1.125rem;
    border: 1px solid rgba(2, 95, 177, 0.1);
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--chatbot-primary);
    border-radius: 50%;
    animation: chatbot-typing-bounce 1.4s infinite;
}

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

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

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

/* ==========================================================================
   FORMULÁRIO DE CONTATO
   ========================================================================== */

.chatbot-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 1rem;
    background: rgba(2, 95, 177, 0.02);
    border-radius: 0.75rem;
    border: 1px solid rgba(2, 95, 177, 0.1);
    margin-top: 0.5rem;
}

.chatbot-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.chatbot-form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--chatbot-primary-dark);
}

.chatbot-form-input {
    padding: 0.75rem;
    border: 2px solid rgba(2, 95, 177, 0.15);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: var(--chatbot-transition);
    background: white;
}

.chatbot-form-input:focus {
    outline: none;
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(2, 95, 177, 0.1);
}

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

.chatbot-form-submit {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--chatbot-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(2, 95, 177, 0.2);
}

.chatbot-form-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(2, 95, 177, 0.3);
}

.chatbot-form-submit:active {
    transform: translateY(0);
}

/* ==========================================================================
   ÁREA DE INPUT
   ========================================================================== */

.chatbot-input-area {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(2, 95, 177, 0.1);
    background: white;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 0.875rem 1.125rem;
    border: 2px solid rgba(2, 95, 177, 0.15);
    border-radius: 1.5rem;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: var(--chatbot-transition);
    background: rgba(2, 95, 177, 0.02);
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--chatbot-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(2, 95, 177, 0.05);
}

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

.chatbot-send {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--chatbot-transition);
    box-shadow: 0 4px 6px rgba(2, 95, 177, 0.2);
}

.chatbot-send:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 10px rgba(2, 95, 177, 0.3);
}

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

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   SUGESTÕES RÁPIDAS
   ========================================================================== */

.chatbot-suggestions {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem 1rem 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.chatbot-suggestions::-webkit-scrollbar {
    display: none;
}

.chatbot-suggestion-chip {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid rgba(2, 95, 177, 0.2);
    border-radius: 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--chatbot-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--chatbot-transition);
}

.chatbot-suggestion-chip:hover {
    background: var(--chatbot-primary);
    color: white;
    border-color: var(--chatbot-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(2, 95, 177, 0.2);
}

/* ==========================================================================
   CARDS DE MÁQUINAS
   ========================================================================== */

.chatbot-machine-card {
    background: white;
    border: 2px solid rgba(2, 95, 177, 0.1);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-top: 0.5rem;
    transition: var(--chatbot-transition);
    cursor: pointer;
}

.chatbot-machine-card:hover {
    border-color: var(--chatbot-primary);
    box-shadow: 0 4px 12px rgba(2, 95, 177, 0.15);
    transform: translateY(-2px);
}

.chatbot-machine-card h4 {
    color: var(--chatbot-primary-dark);
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-machine-card p {
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.5;
}

.chatbot-machine-features {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chatbot-machine-tag {
    padding: 0.25rem 0.625rem;
    background: rgba(2, 95, 177, 0.08);
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--chatbot-primary);
}

/* ==========================================================================
   RESPONSIVO - MOBILE
   ========================================================================== */

@media (max-width: 768px) {
    .chatbot-button {
        width: 60px;
        height: 60px;
        bottom: 1.5rem;
        left: 1.5rem;
        font-size: 1.5rem;
    }

    .chatbot-window {
        bottom: 90px;
        left: 1rem;
        right: 1rem;
        width: calc(100vw - 2rem);
        height: calc(100vh - 120px);
        max-height: calc(100vh - 120px);
    }

    .chatbot-header {
        padding: 1rem 1.25rem;
    }

    .chatbot-header-text h3 {
        font-size: 1rem;
    }

    .chatbot-header-text p {
        font-size: 0.8rem;
    }

    .chatbot-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .chatbot-messages {
        padding: 1rem;
    }

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

    .chatbot-message-bubble {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .chatbot-input-area {
        padding: 0.875rem 1rem;
    }

    .chatbot-form {
        padding: 0.875rem;
    }
}

@media (max-width: 480px) {
    .chatbot-button {
        width: 55px;
        height: 55px;
        bottom: 1rem;
        left: 1rem;
    }

    .chatbot-window {
        bottom: 80px;
        left: 0.5rem;
        right: 0.5rem;
        width: calc(100vw - 1rem);
    }

    .chatbot-option-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}

/* ==========================================================================
   ESTADOS E UTILIDADES
   ========================================================================== */

.chatbot-hidden {
    display: none !important;
}

.chatbot-fade-in {
    animation: chatbot-fade-in 0.3s ease-out;
}

@keyframes chatbot-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Marca de leitura */
.chatbot-message-read {
    font-size: 0.7rem;
    color: var(--chatbot-primary);
    margin-top: 0.25rem;
}

/* Loading state para botões */
.chatbot-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.chatbot-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: chatbot-spin 0.6s linear infinite;
}

@keyframes chatbot-spin {
    to { transform: rotate(360deg); }
}
