/* Widget + painel — chat suporte GSM */
.fu-chat-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99988;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    pointer-events: auto;
    cursor: pointer;
}

.fu-chat-backdrop.open {
    display: block;
}

body.fu-chat-open {
    overflow: hidden;
    overscroll-behavior: none;
}

#fu-suporte-root {
    --fu-chat-green: #39ff83;
    --fu-chat-bg: #0a100c;
    --fu-chat-panel: #0f1612;
    --fu-chat-line: rgba(57, 255, 131, 0.2);
    --fu-chat-z: 99990;
    font-family: "Segoe UI", system-ui, sans-serif;
    position: fixed;
    right: 0;
    bottom: 0;
    width: 0;
    height: 0;
    overflow: visible;
    z-index: 99990;
    pointer-events: none;
}

#fu-suporte-root .fu-chat-launcher,
#fu-suporte-root .fu-chat-panel {
    pointer-events: auto;
}

#fu-suporte-root * {
    box-sizing: border-box;
}

.fu-chat-launcher {
    position: fixed;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 62px));
    z-index: var(--fu-chat-z);
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(145deg, #2ee06a, #16a34a);
    color: #041208;
    box-shadow: 0 8px 28px rgba(57, 255, 131, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    display: grid;
    place-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fu-chat-launcher:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 36px rgba(57, 255, 131, 0.45);
}

.fu-chat-launcher svg {
    width: 26px;
    height: 26px;
}

.fu-chat-launcher .fu-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #0a100c;
}

.fu-chat-launcher.has-unread .fu-chat-badge {
    display: flex;
}

.fu-chat-panel {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: calc(var(--fu-chat-z) + 1);
    width: min(380px, calc(100vw - 24px));
    max-height: min(560px, calc(100dvh - 24px));
    display: none;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid var(--fu-chat-line);
    background: linear-gradient(180deg, #121a15, var(--fu-chat-panel));
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), 0 0 40px rgba(57, 255, 131, 0.08);
    overflow: hidden;
}

.fu-chat-panel.open {
    display: flex;
    animation: fuChatSlide 0.28s ease;
}

@keyframes fuChatSlide {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.fu-chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--fu-chat-line);
    background: rgba(0, 0, 0, 0.25);
}

.fu-chat-head-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #64748b;
    box-shadow: 0 0 8px rgba(100, 116, 139, 0.5);
    flex-shrink: 0;
}

.fu-chat-head-dot.online {
    background: var(--fu-chat-green);
    box-shadow: 0 0 12px rgba(57, 255, 131, 0.8);
    animation: fuChatPulse 2s ease infinite;
}

@keyframes fuChatPulse {
    50% {
        opacity: 0.65;
    }
}

.fu-chat-head-title {
    flex: 1;
    min-width: 0;
}

.fu-chat-head-title b {
    display: block;
    font-size: 14px;
    color: #ecfff3;
}

.fu-chat-head-title span {
    font-size: 11px;
    color: #8fb39b;
}

.fu-chat-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #b8ffd3;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.fu-chat-body {
    flex: 1;
    overflow: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    max-height: 320px;
}

.fu-chat-offline {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
    color: #ffe3a3;
    font-size: 13px;
    line-height: 1.5;
}

.fu-chat-offline a {
    display: inline-flex;
    margin-top: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    background: #25d366;
    color: #041208;
    font-weight: 800;
    font-size: 12px;
    text-decoration: none;
}

.fu-chat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fu-chat-form label {
    font-size: 11px;
    font-weight: 700;
    color: #9fd4b0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.fu-chat-form-intro {
    font-size: 12px;
    line-height: 1.55;
    color: #b8e6c8;
    margin: 0 0 4px;
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--fu-chat-green);
    background: rgba(57, 255, 131, 0.06);
}

.fu-chat-form-intro strong {
    color: #ecfff3;
}

.fu-chat-form select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--fu-chat-line);
    background: rgba(0, 0, 0, 0.35);
    color: #ecfff3;
    font-size: 13px;
    font-family: inherit;
}

.fu-chat-form input,
.fu-chat-form textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--fu-chat-line);
    background: rgba(0, 0, 0, 0.35);
    color: #ecfff3;
    font-size: 13px;
    font-family: inherit;
}

.fu-chat-form textarea {
    min-height: 72px;
    resize: vertical;
}

.fu-chat-msg {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}

.fu-chat-msg.visitante {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(57, 255, 131, 0.22), rgba(34, 197, 94, 0.14));
    border: 1px solid rgba(57, 255, 131, 0.25);
    color: #dfffea;
    border-bottom-right-radius: 4px;
}

.fu-chat-msg.admin {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: #e8f5ec;
    border-bottom-left-radius: 4px;
}

.fu-chat-msg.sistema,
.fu-suporte-admin-msg.sistema {
    align-self: flex-start;
    max-width: 92%;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #bae6fd;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    border-bottom-left-radius: 4px;
}

.fu-chat-msg .fu-msg-label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fu-chat-msg.admin .fu-msg-label {
    color: #39ff83;
    opacity: 0.95;
}

.fu-chat-msg.sistema .fu-msg-label {
    color: #7dd3fc;
    opacity: 0.85;
}

.fu-chat-msg time {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    opacity: 0.65;
}

.fu-chat-foot {
    padding: 12px;
    border-top: 1px solid var(--fu-chat-line);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 8px;
}

.fu-chat-foot textarea {
    flex: 1;
    min-height: 42px;
    max-height: 100px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--fu-chat-line);
    background: rgba(0, 0, 0, 0.35);
    color: #ecfff3;
    font-size: 13px;
    resize: none;
    font-family: inherit;
}

.fu-chat-send {
    align-self: flex-end;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--fu-chat-green), #22c55e);
    color: #041208;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
}

.fu-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fu-chat-status {
    font-size: 12px;
    line-height: 1.45;
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 8px;
}

.fu-chat-status-live {
    background: rgba(57, 255, 131, 0.1);
    border: 1px solid rgba(57, 255, 131, 0.25);
    color: #9fd4b0;
}

.fu-chat-status-closed {
    background: rgba(255, 193, 7, 0.12);
    border: 1px solid rgba(255, 193, 7, 0.35);
    color: #ffe9a8;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.45;
}

.fu-chat-status-queue {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #b8c5d6;
}

.fu-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #39ff83;
    margin-right: 6px;
    animation: fuLivePulse 1.2s ease infinite;
}

@keyframes fuLivePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

.fu-chat-wa-link {
    display: block;
    margin: 8px 0 0;
    font-size: 12px;
    font-weight: 700;
    color: #5eead4;
}

.fu-chat-msgs-wrap {
    max-height: 280px;
    overflow: auto;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fu-chat-msg-new {
    animation: fuMsgIn 0.35s ease;
}

.fu-chat-msg-pending {
    opacity: 0.65;
}

@keyframes fuMsgIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Painel admin: layout em suporte-desk.css (só .fu-page-suporte) */

@media (max-width: 800px) {
    body.fu-chat-open .fu-chat-panel.open {
        max-height: 100dvh;
        border-radius: 16px 16px 0 0;
    }

    .fu-chat-launcher {
        width: 56px;
        height: 56px;
        min-width: 56px;
        padding: 0;
        border-radius: 50%;
        display: grid;
        place-items: center;
        bottom: max(78px, calc(env(safe-area-inset-bottom) + 62px));
        right: max(12px, env(safe-area-inset-right));
    }

    .fu-chat-launcher svg {
        width: 26px;
        height: 26px;
    }

    .fu-chat-panel {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-height: 100dvh;
        border-radius: 16px 16px 0 0;
    }
}
