/* ====================================== */
/* Chat com Ollama - Widget Flutuante */
/* ====================================== */

#ollama-chat-container {
    font-family: var(--fonte-texto);
}

.ollama-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

/* Botão Flutuante */
.ollama-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--verde-primario);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(45, 80, 22, 0.4);
    transition: all 0.3s ease;
    color: white;
    animation: chatPulse 2s ease-in-out infinite;
    position: relative;
}

.ollama-chat-toggle:hover {
    transform: scale(1.1);
    background: var(--verde-secundario);
    box-shadow: 0 6px 24px rgba(45, 80, 22, 0.6);
}

.ollama-chat-toggle:active {
    transform: scale(0.95);
}

.ollama-chat-toggle svg {
    width: 24px;
    height: 24px;
}

.ollama-chat-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--verde-primario);
    animation: chatPulseRing 2s ease-in-out infinite;
}

@keyframes chatPulse {

    0%,
    100% {
        box-shadow: 0 4px 16px rgba(45, 80, 22, 0.4);
    }

    50% {
        box-shadow: 0 4px 24px rgba(45, 80, 22, 0.7);
    }
}

@keyframes chatPulseRing {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.ollama-chat-toggle-active {
    background: var(--verde-secundario);
    box-shadow: 0 6px 24px rgba(45, 80, 22, 0.6);
}

/* Janela de Chat */
.ollama-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    animation: slideUpChat 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

@keyframes slideUpChat {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ollama-chat-header {
    background: linear-gradient(135deg, var(--verde-primario) 0%, var(--verde-secundario) 100%);
    color: white;
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.ollama-chat-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ollama-chat-title h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
}

.ollama-chat-status {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ollama-chat-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    animation: chatStatusPulse 2s ease-in-out infinite;
}

@keyframes chatStatusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.ollama-chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    padding: 0;
}

.ollama-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Área de Mensagens */
.ollama-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f9f9f9;
}

.ollama-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ollama-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ollama-chat-messages::-webkit-scrollbar-thumb {
    background: var(--verde-primario);
    border-radius: 3px;
}

.ollama-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--verde-secundario);
}

/* Mensagens */
.ollama-chat-message {
    display: flex;
    animation: fadeInChat 0.3s ease;
}

@keyframes fadeInChat {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ollama-chat-message-user {
    justify-content: flex-end;
}

.ollama-chat-message-ai {
    justify-content: flex-start;
}

.ollama-chat-message-content {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.ollama-chat-message-user .ollama-chat-message-content {
    background: var(--verde-primario);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 6px rgba(45, 80, 22, 0.2);
}

.ollama-chat-message-ai .ollama-chat-message-content {
    background: white;
    color: var(--texto-escuro);
    border-bottom-left-radius: 4px;
    border: 1px solid #e0e0e0;
}

.ollama-chat-message-typing .ollama-chat-message-content {
    animation: typeAnimation 1s ease-in-out;
}

@keyframes typeAnimation {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Área de Input */
.ollama-chat-input-area {
    border-top: 1px solid #e0e0e0;
    padding: 0.75rem;
    background: white;
}

.ollama-chat-form {
    display: flex;
    gap: 0.5rem;
}

.ollama-chat-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 0.6rem 1rem;
    font-family: var(--fonte-texto);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.ollama-chat-input:focus {
    border-color: var(--verde-primario);
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

.ollama-chat-input::placeholder {
    color: #999;
}

.ollama-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--verde-primario);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ollama-chat-send:hover:not(:disabled) {
    background: var(--verde-secundario);
    transform: scale(1.05);
}

.ollama-chat-send:active:not(:disabled) {
    transform: scale(0.95);
}

.ollama-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Footer */
.ollama-chat-footer {
    border-top: 1px solid #e0e0e0;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    background: #fafafa;
}

/* Responsivo */
@media (max-width: 480px) {
    .ollama-chat-window {
        width: calc(100vw - 40px);
        height: 80vh;
        max-height: 500px;
        bottom: 80px;
        right: auto;
        left: 20px;
    }

    .ollama-chat-toggle {
        width: 56px;
        height: 56px;
    }

    .ollama-chat-toggle svg {
        width: 22px;
        height: 22px;
    }

    .ollama-chat-message-content {
        max-width: 90%;
    }
}