/**
 * Chatbot Widget - Estilos
 * Sistema de agendamento online
 * Usa variáveis CSS do sistema de temas
 */

/* Widget container */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Botão flutuante - Usa tema do estabelecimento */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradiente-hero, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: var(--sombra-card, 0 4px 12px rgba(102, 126, 234, 0.4));
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
}

/* Janela do chat */
.chatbot-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

/* Header - Usa tema do estabelecimento */
.chatbot-header {
    background: var(--gradiente-hero, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

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

/* Área de mensagens */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

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

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

/* Mensagem */
.chatbot-message {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
}

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

.chatbot-message.bot {
    justify-content: flex-start;
}

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

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

.chatbot-message.bot .message-content {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

/* Área de input */
.chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    min-height: 70px;
    max-height: 300px;
    overflow-y: auto;
}

.chatbot-input-area::-webkit-scrollbar {
    width: 6px;
}

.chatbot-input-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-input-area::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chatbot-input-area::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Botões */
.chatbot-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatbot-btn {
    background: white;
    border: 2px solid var(--cor-primaria, #667eea);
    color: var(--cor-primaria, #667eea);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
}

.chatbot-btn:hover {
    background: var(--cor-primaria, #667eea);
    color: white;
    transform: translateX(4px);
}

.chatbot-btn-primary {
    background: var(--gradiente-hero, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    color: white;
    border: none;
    text-align: center;
}

.chatbot-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--sombra-card, 0 4px 12px rgba(102, 126, 234, 0.3));
}

/* Formulário */
.chatbot-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--cor-primaria, #667eea);
}

.form-group input::placeholder {
    color: #a0aec0;
}

/* Responsivo - Mobile */
@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 0;
        right: 0;
    }

    .chatbot-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

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

    .chatbot-toggle {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }

    .message-content {
        max-width: 85%;
        font-size: 15px;
    }

    .chatbot-input-area {
        max-height: 400px;
    }
}

/* Estados de carregamento */
.chatbot-loading {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: bounce 1.4s infinite ease-in-out;
    margin: 0 2px;
}

.chatbot-loading:nth-child(1) {
    animation-delay: -0.32s;
}

.chatbot-loading:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Acessibilidade */
.chatbot-btn:focus,
.chatbot-toggle:focus,
.chatbot-close:focus,
.form-group input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
