/* chat-widget.css - Estilos premium para o widget de chat do assistente inteligente */

/* Variáveis do Tema (Baseado em Tons de Natureza e Aventura com HSL) */
:root {
    --al-chat-primary: hsl(142, 70%, 29%);       /* Verde floresta premium */
    --al-chat-primary-hover: hsl(142, 70%, 24%);
    --al-chat-secondary: #0ea5e9;                 /* Azul céu (ecoturismo) */
    --al-chat-gradient: linear-gradient(135deg, hsl(142, 70%, 29%) 0%, #0284c7 100%);
    --al-chat-bg-glass: rgba(255, 255, 255, 0.85); /* Vidro claro */
    --al-chat-bg-dark: #1e293b;                   /* Fundo escuro */
    --al-chat-text-light: #f8fafc;
    --al-chat-text-dark: #0f172a;
    --al-chat-border-glass: rgba(255, 255, 255, 0.4);
    --al-chat-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    --al-chat-radius: 20px;
    --al-chat-font: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* -------------------------------------------------------------
 * 1. BOTÃO FLUTUANTE (FAB)
 * ------------------------------------------------------------- */
#al-chat-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--al-chat-gradient);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#al-chat-launcher:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

#al-chat-launcher svg {
    width: 28px;
    height: 28px;
    fill: var(--al-chat-text-light);
    transition: transform 0.3s ease;
}

#al-chat-launcher.active svg {
    transform: rotate(90deg);
}

/* Badge de Notificação */
#al-chat-launcher::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    animation: al-pulse 2s infinite;
}

#al-chat-launcher.active::after {
    display: none;
}

/* -------------------------------------------------------------
 * 2. CONTAINER DA JANELA DO CHAT (Glassmorphism)
 * ------------------------------------------------------------- */
#al-chat-window {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 120px);
    border-radius: var(--al-chat-radius);
    background: var(--al-chat-bg-glass);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border: 1px solid var(--al-chat-border-glass);
    box-shadow: var(--al-chat-shadow);
    z-index: 99998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--al-chat-font);
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#al-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* -------------------------------------------------------------
 * 3. CABEÇALHO DO CHAT
 * ------------------------------------------------------------- */
.al-chat-header {
    background: var(--al-chat-gradient);
    padding: 20px;
    color: var(--al-chat-text-light);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

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

.al-chat-header-info {
    flex-grow: 1;
}

.al-chat-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

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

.al-chat-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #22c55e; /* verde online */
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #22c55e;
}

.al-chat-close {
    background: transparent;
    border: none;
    color: var(--al-chat-text-light);
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 0;
    display: flex;
}

.al-chat-close:hover {
    opacity: 1;
}

/* -------------------------------------------------------------
 * 4. ÁREA DE MENSAGENS
 * ------------------------------------------------------------- */
.al-chat-messages-container {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
    background: rgba(255, 255, 255, 0.2);
}

/* Estilo do Scrollbar */
.al-chat-messages-container::-webkit-scrollbar {
    width: 6px;
}
.al-chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}
.al-chat-messages-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* Balões de Mensagem */
.al-chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: al-slide-up 0.3s ease-out forwards;
    position: relative;
}

/* Balão do Usuário */
.al-chat-bubble.user {
    align-self: flex-end;
    background: var(--al-chat-primary);
    color: var(--al-chat-text-light);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(22, 101, 52, 0.15);
}

/* Balão do Assistente */
.al-chat-bubble.assistant {
    align-self: flex-start;
    background: white;
    color: var(--al-chat-text-dark);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Markdown Básico e Citações */
.al-chat-bubble p { margin: 0 0 8px 0; }
.al-chat-bubble p:last-child { margin-bottom: 0; }
.al-chat-bubble strong { font-weight: 700; }
.al-chat-bubble .source-citation {
    display: inline-block;
    margin-top: 5px;
    font-size: 11px;
    color: var(--al-chat-secondary);
    font-weight: 600;
}

/* -------------------------------------------------------------
 * 5. ÁREA DE INPUT (Entrada de texto)
 * ------------------------------------------------------------- */
.al-chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.al-chat-input {
    flex-grow: 1;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 13.5px;
    font-family: var(--al-chat-font);
    outline: none;
    transition: all 0.2s;
    background: #f8fafc;
}

.al-chat-input:focus {
    border-color: var(--al-chat-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.1);
}

.al-chat-send-btn {
    background: var(--al-chat-gradient);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

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

.al-chat-send-btn svg {
    width: 18px;
    height: 18px;
    fill: var(--al-chat-text-light);
    transform: translateX(1px);
}

/* -------------------------------------------------------------
 * 6. ELEMENTOS DINÂMICOS (Sugestões & Indicador de Digitação)
 * ------------------------------------------------------------- */

/* Sugestões de Perguntas Iniciais */
.al-chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    animation: al-fade-in 0.5s ease-out;
}

.al-chat-suggestion-btn {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(22, 101, 52, 0.2);
    color: var(--al-chat-primary);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-family: var(--al-chat-font);
}

.al-chat-suggestion-btn:hover {
    background: var(--al-chat-primary);
    color: white;
    transform: translateY(-1px);
}

/* Typing Indicator (Três pontinhos pulsantes) */
.al-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.al-typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: al-typing-bounce 1.4s infinite ease-in-out both;
}

.al-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.al-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* -------------------------------------------------------------
 * 7. ANIMAÇÕES (KEYFRAMES)
 * ------------------------------------------------------------- */
@keyframes al-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

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

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

@keyframes al-typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* -------------------------------------------------------------
 * 8. ADAPTABILIDADE MOBILE (Responsividade)
 * ------------------------------------------------------------- */
@media (max-width: 480px) {
    #al-chat-window {
        bottom: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
    }
    
    #al-chat-launcher {
        bottom: 15px;
        right: 15px;
    }
}
