/* Chat cliente login — visual e UX estilo WhatsApp */
body.fu-page-login #fu-suporte-root .fu-chat-panel,
body.fu-page-painel-cliente #fu-suporte-root .fu-chat-panel {
    --fu-wa-header: #075e54;
    --fu-wa-header-dark: #054d44;
    width: min(400px, 100vw);
    max-width: 100vw;
    max-height: min(92dvh, 640px);
    border-radius: 0;
    border: none;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (max-width: 520px) {
    body.fu-page-login #fu-suporte-root .fu-chat-panel.open,
    body.fu-page-painel-cliente #fu-suporte-root .fu-chat-panel.open {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
}

body.fu-page-login #fu-suporte-root .fu-chat-panel.open,
body.fu-page-painel-cliente #fu-suporte-root .fu-chat-panel.open {
    display: flex !important;
    flex-direction: column;
    animation: fuWaPanelIn 0.18s ease-out;
}

@keyframes fuWaPanelIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

body.fu-page-login .fu-chat-head--wa,
body.fu-page-painel-cliente .fu-chat-head--wa {
    flex-shrink: 0;
    padding: 10px 12px;
    gap: 10px;
    border-bottom: none;
    background: var(--fu-wa-header) !important;
    color: #fff;
}

body.fu-page-login .fu-chat-head--wa .fu-chat-head-title b,
body.fu-page-painel-cliente .fu-chat-head--wa .fu-chat-head-title b {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

body.fu-page-login .fu-chat-head--wa .fu-chat-head-title span,
body.fu-page-painel-cliente .fu-chat-head--wa .fu-chat-head-title span {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
}

body.fu-page-login .fu-chat-head-dot.online,
body.fu-page-painel-cliente .fu-chat-head-dot.online {
    display: none;
}

/* Conversa encerrada — transição e formulário */
.fu-chat-ended-hero {
    text-align: center;
    padding: 18px 14px 14px;
    margin: 0 0 12px;
    border-radius: 12px;
    background: linear-gradient(160deg, rgba(7, 94, 84, 0.35), rgba(11, 20, 26, 0.9));
    border: 1px solid rgba(37, 211, 102, 0.35);
}

.fu-chat-ended-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: linear-gradient(145deg, #25d366, #128c7e);
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
}

.fu-chat-ended-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: #e9edef;
}

.fu-chat-ended-text,
.fu-chat-ended-cta {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(233, 237, 239, 0.88);
}

.fu-chat-ended-cta {
    margin-top: 8px;
    color: #aebac1;
}

.fu-chat-panel.fu-chat-mode-ended .fu-chat-form-intro {
    color: #25d366;
    font-weight: 600;
}

.fu-chat-msgs--closing {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}

.fu-chat-foot--closing {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.fu-chat-panel.fu-chat-session-ended .fu-chat-body--wa {
    filter: blur(2px);
    opacity: 0.65;
    transition: filter 0.35s ease, opacity 0.35s ease;
    pointer-events: none;
}

.fu-chat-panel.fu-chat-session-ended .fu-chat-foot,
.fu-chat-foot.fu-chat-foot--closing {
    pointer-events: none;
    opacity: 0.35;
}

.fu-chat-panel.fu-chat-mode-ended .fu-chat-form {
    pointer-events: auto;
}

.fu-chat-panel.fu-chat-mode-ended .fu-chat-ended-hero {
    animation: fuWaMsgIn 0.3s ease-out;
}

body.fu-page-login .fu-chat-avatar,
body.fu-page-painel-cliente .fu-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #25d366, #128c7e);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

body.fu-page-login .fu-chat-back,
body.fu-page-painel-cliente .fu-chat-back {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0 -4px 0 0;
}

body.fu-page-login .fu-chat-back:hover,
body.fu-page-painel-cliente .fu-chat-back:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.fu-page-login .fu-chat-body--wa,
body.fu-page-painel-cliente .fu-chat-body--wa {
    flex: 1;
    min-height: 0;
    max-height: none;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0b141a;
}

body.fu-page-login .fu-chat-body--wa .fu-chat-msgs-wrap,
body.fu-page-painel-cliente .fu-chat-body--wa .fu-chat-msgs-wrap {
    flex: 1;
    min-height: 120px;
    max-height: none !important;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

body.fu-page-login .fu-chat-hints,
body.fu-page-painel-cliente .fu-chat-hints {
    flex-shrink: 0;
    padding: 8px 12px 4px;
    transition: opacity 0.15s ease, max-height 0.2s ease, padding 0.2s ease;
    max-height: 120px;
    overflow: hidden;
}

body.fu-page-login .fu-chat-panel.fu-chat-is-composing .fu-chat-composer-hide,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-is-composing .fu-chat-composer-hide,
body.fu-page-login .fu-chat-panel.fu-chat-form-focus .fu-chat-composer-hide,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-focus .fu-chat-composer-hide {
    opacity: 0;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    pointer-events: none;
}

/* Formulário inicial — some inscrições ao clicar / enviar */
body.fu-page-login .fu-chat-form--wa .fu-chat-form-intro,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-form-intro {
    transition: opacity 0.18s ease, max-height 0.2s ease, margin 0.2s ease;
    max-height: 80px;
    overflow: hidden;
}

body.fu-page-login .fu-chat-panel.fu-chat-form-focus .fu-chat-form-intro,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-focus .fu-chat-form-intro,
body.fu-page-login .fu-chat-panel.fu-chat-form-sending .fu-chat-form-intro,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-sending .fu-chat-form-intro {
    opacity: 0;
    max-height: 0;
    margin: 0 !important;
    pointer-events: none;
}

/* Some rótulos (Nome, WhatsApp…) ao digitar */
body.fu-page-login .fu-chat-form--wa .fu-chat-lbl,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-lbl {
    display: block;
    transition: opacity 0.15s ease, max-height 0.18s ease, margin 0.18s ease;
    max-height: 24px;
    overflow: hidden;
}

body.fu-page-login .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa .fu-chat-lbl,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa .fu-chat-lbl {
    opacity: 0;
    max-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
}

body.fu-page-login .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa input,
body.fu-page-login .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa select,
body.fu-page-login .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa textarea,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa input,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa select,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa textarea {
    margin-top: 0 !important;
}

body.fu-page-login .fu-chat-form--wa input::placeholder,
body.fu-page-login .fu-chat-form--wa textarea::placeholder,
body.fu-page-painel-cliente .fu-chat-form--wa input::placeholder,
body.fu-page-painel-cliente .fu-chat-form--wa textarea::placeholder {
    color: #8696a0;
    opacity: 1;
}

body.fu-page-login .fu-chat-panel.fu-chat-form-sending .fu-chat-form--wa,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-sending .fu-chat-form--wa {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    margin: 0;
    padding: 0;
    transition: opacity 0.2s ease, max-height 0.25s ease;
}

body.fu-page-login .fu-chat-panel.fu-chat-form-sending .fu-chat-ended-hero,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-sending .fu-chat-ended-hero {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    pointer-events: none;
}

.fu-chat-starting {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 32px 20px;
    min-height: 200px;
    animation: fuWaMsgIn 0.25s ease-out;
}

.fu-chat-starting p {
    margin: 0;
    font-size: 14px;
    color: #aebac1;
    font-weight: 500;
}

.fu-chat-starting-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: #25d366;
    border-radius: 50%;
    animation: fuChatSpin 0.75s linear infinite;
}

@keyframes fuChatSpin {
    to {
        transform: rotate(360deg);
    }
}

body.fu-page-login .fu-chat-body--wa,
body.fu-page-painel-cliente .fu-chat-body--wa {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

body.fu-page-login .fu-chat-hint-live,
body.fu-page-login .fu-chat-hint-off,
body.fu-page-painel-cliente .fu-chat-hint-live,
body.fu-page-painel-cliente .fu-chat-hint-off {
    margin: 0 0 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
    background: #182229;
    color: #8696a0;
}

body.fu-page-login .fu-chat-hint-live,
body.fu-page-painel-cliente .fu-chat-hint-live {
    color: #25d366;
}

body.fu-page-login .fu-chat-wa-link--compact,
body.fu-page-painel-cliente .fu-chat-wa-link--compact {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #53bdeb;
    text-decoration: none;
    padding: 4px 0 6px;
}

body.fu-page-login .fu-chat-foot,
body.fu-page-painel-cliente .fu-chat-foot {
    flex-shrink: 0;
}

body.fu-page-login .fu-chat-input-shell,
body.fu-page-painel-cliente .fu-chat-input-shell {
    flex: 1;
    display: block;
    margin: 0;
}

body.fu-page-login .fu-chat-foot textarea,
body.fu-page-painel-cliente .fu-chat-foot textarea {
    width: 100%;
    resize: none;
    overflow-y: hidden;
    line-height: 1.35;
}

body.fu-page-login .fu-chat-foot textarea:focus,
body.fu-page-painel-cliente .fu-chat-foot textarea:focus {
    outline: none;
}

body.fu-page-login .fu-chat-foot textarea::placeholder,
body.fu-page-painel-cliente .fu-chat-foot textarea::placeholder {
    color: #8696a0;
    transition: opacity 0.12s;
}

body.fu-page-login .fu-chat-foot textarea:focus::placeholder,
body.fu-page-painel-cliente .fu-chat-foot textarea:focus::placeholder {
    opacity: 0;
}

body.fu-page-login .fu-wa-send-btn,
body.fu-page-painel-cliente .fu-wa-send-btn {
    font-size: 0 !important;
}

body.fu-page-login .fu-wa-send-btn svg,
body.fu-page-painel-cliente .fu-wa-send-btn svg {
    display: block;
}

body.fu-page-login .fu-chat-msg.fu-chat-msg-pending,
body.fu-page-painel-cliente .fu-chat-msg.fu-chat-msg-pending {
    opacity: 0.72;
}

body.fu-page-login .fu-chat-msg.fu-chat-msg-new,
body.fu-page-painel-cliente .fu-chat-msg.fu-chat-msg-new {
    animation: fuWaMsgIn 0.2s ease-out;
}

@keyframes fuWaMsgIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

body.fu-page-login .fu-chat-form--wa .fu-chat-form-topics,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-form-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px;
}

body.fu-page-login .fu-chat-form--wa .fu-chat-form-topics span,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-form-topics span {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid rgba(0, 168, 132, 0.35);
    background: rgba(0, 168, 132, 0.1);
    color: #7fd4b8;
}

body.fu-page-login .fu-chat-form--wa .fu-chat-field,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-field {
    margin-bottom: 10px;
}

body.fu-page-login .fu-chat-form--wa .fu-chat-field input,
body.fu-page-login .fu-chat-form--wa .fu-chat-field select,
body.fu-page-login .fu-chat-form--wa .fu-chat-field textarea,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-field input,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-field select,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-field textarea {
    width: 100%;
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

body.fu-page-login .fu-chat-form--wa .fu-chat-field--focus input,
body.fu-page-login .fu-chat-form--wa .fu-chat-field--focus select,
body.fu-page-login .fu-chat-form--wa .fu-chat-field--focus textarea,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-field--focus input,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-field--focus select,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-field--focus textarea {
    box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.45);
    background: #31424a !important;
}

body.fu-page-login .fu-chat-form--wa .fu-chat-send--start,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-send--start {
    width: 100%;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 12px 16px !important;
    transition: filter 0.15s ease, transform 0.15s ease;
}

body.fu-page-login .fu-chat-form--wa .fu-chat-send--start:hover:not(:disabled),
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-send--start:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

body.fu-page-login .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa .fu-chat-form-topics,
body.fu-page-painel-cliente .fu-chat-panel.fu-chat-form-focus .fu-chat-form--wa .fu-chat-form-topics {
    opacity: 0.35;
    transition: opacity 0.2s ease;
}

body.fu-page-login .fu-chat-form--wa .fu-chat-form-intro,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-form-intro {
    font-size: 12px;
    line-height: 1.45;
    color: #8696a0;
    margin-bottom: 10px;
}

body.fu-page-login .fu-chat-form--wa label,
body.fu-page-painel-cliente .fu-chat-form--wa label {
    font-size: 12px;
    color: #aebac1;
}

body.fu-page-login .fu-chat-form--wa input,
body.fu-page-login .fu-chat-form--wa select,
body.fu-page-login .fu-chat-form--wa textarea,
body.fu-page-painel-cliente .fu-chat-form--wa input,
body.fu-page-painel-cliente .fu-chat-form--wa select,
body.fu-page-painel-cliente .fu-chat-form--wa textarea {
    background: #2a3942 !important;
    border: none !important;
    color: #e9edef !important;
    border-radius: 8px !important;
}

body.fu-page-login .fu-chat-form--wa .fu-chat-send,
body.fu-page-painel-cliente .fu-chat-form--wa .fu-chat-send {
    border-radius: 24px !important;
    background: #00a884 !important;
    margin-top: 8px;
}

body.fu-page-login .fu-chat-hint-you,
body.fu-page-painel-cliente .fu-chat-hint-you {
    margin: 0 0 6px;
    font-size: 11px;
    color: #8696a0;
    text-align: center;
}

body.fu-page-login .fu-chat-hint-you strong,
body.fu-page-painel-cliente .fu-chat-hint-you strong {
    color: #aebac1;
    font-weight: 600;
}

/* Digitando — estilo WhatsApp */
.fu-wa-typing {
    flex-shrink: 0;
    padding: 4px 14px 8px;
}

.fu-wa-typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 88%;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--fu-wa-recv, #202c33);
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.35);
}

.fu-wa-typing-bubble.admin {
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.fu-wa-typing-bubble.visitante {
    margin-left: auto;
    background: var(--fu-wa-sent, #005c4b);
    border-bottom-right-radius: 2px;
}

.fu-wa-typing-label {
    font-size: 12px;
    font-weight: 600;
    color: #53bdeb;
}

.fu-wa-typing-bubble.visitante .fu-wa-typing-label {
    color: rgba(255, 255, 255, 0.85);
}

.fu-wa-typing-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.fu-wa-typing-dots i {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8696a0;
    animation: fuWaTypingDot 1.2s ease-in-out infinite;
}

.fu-wa-typing-bubble.visitante .fu-wa-typing-dots i {
    background: rgba(255, 255, 255, 0.65);
}

.fu-wa-typing-dots i:nth-child(2) {
    animation-delay: 0.15s;
}

.fu-wa-typing-dots i:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes fuWaTypingDot {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.fu-wa-typing-desk {
    padding: 6px 16px 4px;
    background: var(--fu-wa-bg, #0b141a);
    border-top: 1px solid rgba(42, 57, 66, 0.5);
}
