/* Widget de chat flutuante — alinhado às cores do site */
#ppf-chat-root {
    --ppf-chat-toggle-size: 136px;
    --ppf-chat-z: 10050;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--ppf-chat-z);
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    pointer-events: none;
}

#ppf-chat-root > * {
    pointer-events: auto;
}

#ppf-chat-root * {
    box-sizing: border-box;
}

.ppf-chat-toggle {
    position: relative;
    flex-shrink: 0;
    width: var(--ppf-chat-toggle-size);
    height: var(--ppf-chat-toggle-size);
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color, #0066cc), var(--secondary-color, #00a8e8));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 102, 204, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

/* Foto via background-image (JS) — cor atrás de PNG transparente (evita “círculo branco”) */
.ppf-chat-toggle--photo {
    padding: 0;
    background-color: var(--primary-color, #0066cc);
}

.ppf-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 28px rgba(0, 102, 204, 0.45);
}

.ppf-chat-toggle:focus-visible {
    outline: 3px solid var(--accent-color, #ff6b35);
    outline-offset: 3px;
}

.ppf-chat-toggle-icon {
    width: calc(var(--ppf-chat-toggle-size) * 0.45);
    height: calc(var(--ppf-chat-toggle-size) * 0.45);
    max-width: 56px;
    max-height: 56px;
    flex-shrink: 0;
}

/* Estado aberto: só muda o gradiente quando não há foto (ícone SVG) */
.ppf-chat-toggle[aria-expanded="true"]:not(.ppf-chat-toggle--photo) {
    background: linear-gradient(135deg, var(--primary-dark, #0052a3), var(--primary-color, #0066cc));
}

.ppf-chat-toggle--photo[aria-expanded="true"] {
    box-shadow: 0 8px 28px rgba(0, 102, 204, 0.55), 0 0 0 3px rgba(255, 255, 255, 0.45);
}

.ppf-chat-panel {
    position: relative;
    width: min(380px, calc(100vw - 32px));
    max-height: min(520px, calc(100vh - 100px));
    background: var(--bg-white, #ffffff);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ppf-chat-panel.is-open {
    display: flex;
}

.ppf-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary-color, #0066cc), var(--primary-dark, #0052a3));
    color: #fff;
}

.ppf-chat-header-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.ppf-chat-header-sub {
    font-size: 0.75rem;
    opacity: 0.9;
    margin: 2px 0 0;
    font-weight: 400;
}

.ppf-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ppf-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ppf-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    max-height: 280px;
    background: var(--bg-light, #f8f9fa);
}

.ppf-chat-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.ppf-chat-msg--bot {
    align-self: flex-start;
    background: #fff;
    color: var(--text-dark, #1a1a1a);
    border: 1px solid var(--border-color, #e0e0e0);
    border-bottom-left-radius: 4px;
}

.ppf-chat-msg--user {
    align-self: flex-end;
    background: var(--primary-color, #0066cc);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ppf-chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
    background: var(--bg-light, #f8f9fa);
}

.ppf-chat-chip {
    font-size: 0.8rem;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color, #e0e0e0);
    background: #fff;
    color: var(--primary-color, #0066cc);
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}

.ppf-chat-chip:hover {
    background: rgba(0, 102, 204, 0.08);
    border-color: var(--primary-color, #0066cc);
}

.ppf-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-color, #e0e0e0);
    background: #fff;
}

.ppf-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
}

.ppf-chat-input:focus {
    outline: none;
    border-color: var(--primary-color, #0066cc);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.ppf-chat-send {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: var(--primary-color, #0066cc);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.ppf-chat-send:hover {
    background: var(--primary-dark, #0052a3);
}

@media (max-width: 480px) {
    #ppf-chat-root {
        --ppf-chat-toggle-size: 112px;
        bottom: 16px;
        right: 16px;
        left: 16px;
        align-items: stretch;
    }

    .ppf-chat-toggle {
        align-self: flex-end;
    }

    .ppf-chat-panel {
        width: 100%;
        max-height: min(70vh, 480px);
    }

    .ppf-chat-messages {
        max-height: 36vh;
    }
}
