/* ============================================= */
/* CEIA.CSS - ESTILOS EXCLUSIVOS DA ASSISTENTE   */
/* Versão 2.0 - Sincronizada com ceia.html       */
/* ============================================= */

/* ============================================= */
/* VARIÁVEIS CSS (Fallback)                      */
/* ============================================= */
:root {
    --gold: #D4AF37;
    --gold-bright: #f1c40f;
    --black: #0a0a0a;
    --dark-grey: #1a1a1a;
    --white: #ffffff;
    --bg-main: #000000;
    --bg-modal: #0f0f0f;
    --text-primary: #ffffff;
    --input-bg: #111111;
    --input-text: #000000;
    --gold-transparent: rgba(212, 175, 55, 0.2);
}

/* ============================================= */
/* BOTÃO TRIGGER (Lateral do portal)             */
/* ============================================= */
#ceia-trigger {
    position: fixed;
    right: 0;
    top: 70%;
    transform: translateY(-50%);
    background: linear-gradient(145deg, var(--black), var(--dark-grey));
    border: 1px solid var(--gold);
    border-right: none;
    padding: 13px 5px;
    cursor: pointer;
    border-radius: 12px 0 0 12px;
    z-index: 9999;
    transition: all 0.3s ease;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    white-space: nowrap !important;
    align-items: center;
    display: flex !important;
    flex-wrap: nowrap !important;
    width: max-content !important;
    flex-direction: column !important;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    user-select: none;
}

#ceia-trigger:hover {
    background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
    border-color: var(--gold-bright);
    box-shadow: -5px 0 30px rgba(212, 175, 55, 0.3);
}

#ceia-trigger:active {
    transform: translateY(-50%) scale(0.95);
}

#ceia-trigger span {
    width: auto !important;
    display: inline !important;
    pointer-events: none;
}

.gold-text-tab {
    color: var(--gold) !important;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 12px;
}

.white-text-tab {
    color: var(--white) !important;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 12px;
}

/* ============================================= */
/* CONTAINER PRINCIPAL DO CHAT                   */
/* ============================================= */
#ceia-chat-container {
    position: fixed;
    right: 10px;
    bottom: 30px;
    width: 300px;
    height: 500px;
    background: var(--black);
    border: 1px solid var(--gold);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    z-index: 100000;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.9);
    font-family: 'Montserrat', 'Inter', sans-serif;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    color: var(--text-primary);
}

/* Estado oculto */
.ceia-hidden {
    display: none !important;
    opacity: 0;
    transform: translateY(30px);
    pointer-events: none;
}

/* Estado pensando/processando */
.ceia-thinking {
    animation: goldPulse 2s infinite ease-in-out;
    border-color: var(--gold-bright) !important;
}

@keyframes goldPulse {
    0% { box-shadow: 0 0 5px var(--gold); }
    50% { box-shadow: 0 0 25px var(--gold), 0 0 50px rgba(212, 175, 55, 0.3); }
    100% { box-shadow: 0 0 5px var(--gold); }
}

/* ============================================= */
/* CABEÇALHO                                     */
/* ============================================= */
.ceia-header {
    background: var(--dark-grey);
    padding: 15px 20px;
    border-bottom: 1px solid var(--gold-transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 10;
    color: var(--text-primary);
}

.ceia-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gold);
    font-size: 12px;
    letter-spacing: 1px;
    font-weight: 600;
    text-transform: uppercase;
}

.gold-circle {
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
    animation: goldPulse 2s infinite ease-in-out;
}

.ceia-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

#ceia-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#ceia-status-dot.speaking-active {
    animation: speaking 1.2s infinite;
    background: var(--gold-bright) !important;
}

@keyframes speaking {
    0% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.8); 
        opacity: 0.4; 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

.status-text {
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

/* Botão fechar */
.ceia-close-btn { 
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--gold-transparent); 
    color: var(--gold); 
    font-size: 20px; 
    line-height: 1; 
    width: 32px; 
    height: 32px; 
    border-radius: 50%;
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.1); 
    outline: none;
    flex-shrink: 0;
} 

.ceia-close-btn:hover { 
    background: var(--gold); 
    color: var(--black); 
    transform: rotate(90deg);
    box-shadow: 0 0 15px var(--gold), 0 0 30px rgba(212, 175, 55, 0.4);
    border-color: var(--gold-bright); 
}

/* ============================================= */
/* CORPO DO CHAT (Área de mensagens)             */
/* ============================================= */
.ceia-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: radial-gradient(circle at top, #111, #000);
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: var(--text-primary);
}

/* Scrollbar premium */
.ceia-body::-webkit-scrollbar {
    width: 5px;
}

.ceia-body::-webkit-scrollbar-track {
    background: transparent;
}

.ceia-body::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 10px;
}

.ceia-body::-webkit-scrollbar-thumb:hover {
    background: var(--gold-bright);
}

/* Firefox scrollbar */
.ceia-body {
    scrollbar-width: thin;
    scrollbar-color: var(--gold) transparent;
}

/* ============================================= */
/* MENSAGENS                                     */
/* ============================================= */
.ceia-msg {
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 13px;
    max-width: 85%;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeInUp 0.3s ease;
    position: relative;
}

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

/* Mensagem da CEIA */
.msg-ceia {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-left: 3px solid var(--gold);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Mensagem do usuário */
.msg-user {
    background: var(--gold);
    color: var(--black);
    font-weight: 500;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Mensagem do sistema */
.msg-system {
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
    font-size: 11px;
    text-align: center;
    align-self: center;
    max-width: 90%;
    border-radius: 8px;
    padding: 8px 14px;
    font-style: italic;
}

/* ============================================= */
/* INDICADOR DE DIGITAÇÃO                        */
/* ============================================= */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
    opacity: 0.4;
}

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

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

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

/* ============================================= */
/* RODAPÉ (Input e botões)                       */
/* ============================================= */
.ceia-footer {
    flex-shrink: 0;
    padding: 15px;
    background: var(--dark-grey);
    border-top: 1px solid var(--gold-transparent);
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 10;
    color: var(--text-primary);
}

/* Input de texto */
#ceia-input {
    flex: 1;
    background: var(--input-bg);
    color: var(--white) !important;
    border: 1px solid var(--gold);
    padding: 12px 16px;
    border-radius: 10px;
    outline: none;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    min-width: 0;
}

#ceia-input:focus {
    border-color: var(--gold-bright);
    box-shadow: 0 0 15px var(--gold-transparent);
}

#ceia-input::placeholder {
    color: #666;
    font-size: 12px;
    font-style: italic;
}

/* Botão enviar */
#ceia-send {
    background: var(--gold);
    border: none;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#ceia-send:hover {
    background: var(--gold-bright);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

#ceia-send:active {
    transform: scale(0.95);
}

#ceia-send svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

#ceia-send svg path {
    fill: var(--black);
}

/* Botão microfone */
#ceia-voice-btn {
    background: transparent;
    border: 1px solid var(--gold-transparent);
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    color: var(--gold);
    font-size: 18px;
    width: 44px;
    height: 44px;
}

#ceia-voice-btn:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
}

#ceia-voice-btn:active {
    transform: scale(0.95);
}

#ceia-voice-btn.listening {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    animation: pulseRed 1.5s infinite;
}

@keyframes pulseRed {
    0% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); 
    }
}

/* ============================================= */
/* CONTAINER DO IFRAME (Portal)                  */
/* ============================================= */
#ceia-frame-container {
    position: fixed;
    right: 10px;
    bottom: 30px;
    width: 320px;
    height: 520px;
    background: #000;
    border: 1px solid var(--gold);
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.9);
    z-index: 99999;
    overflow: hidden;
}

#ceia-frame-container.ceia-hidden {
    display: none;
}

#ceia-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 20px;
}

.ceia-modal {
    position: relative;
    width: 100%;
    height: 100%;
}

.ceia-modal .ceia-close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 10;
}

/* ============================================= */
/* RESPONSIVIDADE                                */
/* ============================================= */
@media (max-width: 768px) {
    #ceia-chat-container {
        position: fixed;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
        background: var(--black);
        z-index: 99999;
    }

    #ceia-frame-container {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    #ceia-frame {
        border-radius: 0;
    }

    .ceia-header {
        padding: 12px 16px;
        font-size: 14px;
    }

    .ceia-logo {
        font-size: 11px;
    }

    .ceia-body {
        padding: 15px;
        gap: 10px;
        font-size: 15px;
    }

    .ceia-msg {
        font-size: 14px;
        max-width: 90%;
    }

    .ceia-footer {
        padding: 12px;
        gap: 8px;
    }

    #ceia-input {
        font-size: 14px;
        padding: 10px 14px;
    }

    #ceia-send {
        padding: 10px;
        border-radius: 8px;
    }

    #ceia-send svg {
        width: 18px;
        height: 18px;
    }

    #ceia-voice-btn {
        padding: 10px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .ceia-close-btn {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
}

/* ============================================= */
/* REDUÇÃO DE MOVIMENTO (Acessibilidade)         */
/* ============================================= */
@media (prefers-reduced-motion: reduce) {
    #ceia-chat-container,
    #ceia-trigger,
    .ceia-msg,
    #ceia-send,
    #ceia-voice-btn {
        transition: none !important;
        animation: none !important;
    }

    .gold-circle,
    #ceia-status-dot.speaking-active,
    #ceia-voice-btn.listening,
    .ceia-thinking {
        animation: none !important;
    }

    .typing-indicator span {
        animation: none !important;
        opacity: 0.8;
    }
}