/* ================================================================== */
/*  Chatbot PRPG/UFG — Estilos do Widget                             */
/* ================================================================== */

/* ── FAB (botão flutuante) ──────────────────────────────────────── */
.chatbot-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.chatbot-fab:hover {
    background: var(--color-primary-hover);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.22);
}
.chatbot-fab i {
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}
.chatbot-fab.open i {
    transform: rotate(90deg);
}

/* ── Painel de chat ─────────────────────────────────────────────── */
.chatbot-panel {
    position: fixed;
    bottom: 84px;
    right: 20px;
    z-index: 9998;
    width: 380px;
    height: 520px;
    max-height: 70vh;
    display: none;
    flex-direction: column;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}
.chatbot-panel.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* ── Header ─────────────────────────────────────────────────────── */
.chatbot-header {
    height: 36px;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    flex-shrink: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.chatbot-header-info {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
}
.chatbot-header-title {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}
.chatbot-header-sub {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    line-height: 1;
}
.chatbot-header-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.chatbot-header-close:hover {
    opacity: 1;
}

/* ── Corpo de mensagens ─────────────────────────────────────────── */
.chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}
.chatbot-body::-webkit-scrollbar { width: 4px; }
.chatbot-body::-webkit-scrollbar-track { background: transparent; }
.chatbot-body::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

/* ── Bolhas ─────────────────────────────────────────────────────── */
.chatbot-msg {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}
.chatbot-msg.bot {
    align-items: flex-start;
}
.chatbot-msg.user {
    align-items: flex-end;
}
.chatbot-bubble {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    font-family: var(--font-main);
    word-break: break-word;
    white-space: pre-wrap;
}
.chatbot-msg.bot .chatbot-bubble {
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 2px 12px 12px 12px;
}
.chatbot-msg.user .chatbot-bubble {
    max-width: 80%;
    background: var(--color-primary);
    color: #fff;
    border-radius: 12px 12px 2px 12px;
}
.chatbot-bubble a {
    color: var(--color-primary);
    text-decoration: underline;
    font-weight: 500;
}
.chatbot-bubble a:hover {
    color: var(--color-primary-hover);
}

/* ── Botões de opção (quick replies) ────────────────────────────── */
.chatbot-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.chatbot-option-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 12px;
    font-family: var(--font-main);
    color: var(--color-primary);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
    line-height: 1.3;
}
.chatbot-option-btn:hover {
    background: var(--color-primary);
    color: #fff;
}
.chatbot-option-btn:disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

/* ── Indicador digitando ────────────────────────────────────────── */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--color-surface);
    border-radius: 2px 12px 12px 12px;
    width: fit-content;
    margin-bottom: 10px;
}
.chatbot-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-muted);
    animation: chatbot-bounce 1.2s infinite;
}
.chatbot-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatbot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ── Footer (input) ─────────────────────────────────────────────── */
.chatbot-footer {
    border-top: 1px solid var(--color-border-light);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    font-family: var(--font-main);
    color: var(--color-text);
    outline: none;
    padding: 0;
}
.chatbot-input::placeholder {
    color: var(--color-text-muted);
}
.chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.15s, opacity 0.15s;
}
.chatbot-send:hover {
    background: var(--color-primary-hover);
}
.chatbot-send:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ── Formulário inline (ticket) ─────────────────────────────────── */
.chatbot-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-width: 85%;
}
.chatbot-form input {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    font-size: 13px;
    font-family: var(--font-main);
    color: var(--color-text);
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.15s;
}
.chatbot-form input:focus {
    border-color: var(--color-primary);
}
.chatbot-form input::placeholder {
    color: var(--color-text-muted);
}
.chatbot-form-submit {
    align-self: flex-start;
    padding: 7px 18px;
    font-size: 13px;
    font-family: var(--font-main);
    font-weight: 500;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s;
}
.chatbot-form-submit:hover {
    background: var(--color-primary-hover);
}
.chatbot-form-submit:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .chatbot-fab {
        display: none;
    }
    .chatbot-panel {
        width: 100vw;
        height: 45vh;
        right: 0;
        bottom: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    }
    .chatbot-header {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}
