/* Guarda-costas iGo — conversa Premium (canto esquerdo, distinto do atendente). */

.igo-gd-root {
    position: fixed;
    left: auto;
    right: calc(max(12px, env(safe-area-inset-right)) + 48px);
    top: calc(var(--header-height, 64px) + 8px);
    bottom: auto;
    z-index: 10055;
    font-family: Roboto, system-ui, sans-serif;
    --gd-bg: #ffffff;
    --gd-bg2: #f1f3f4;
    --gd-bg3: #e8eaed;
    --gd-border: #dadce0;
    --gd-text: #202124;
    --gd-muted: #5f6368;
    --gd-brand: #003580;
    --gd-accent: #1a73e8;
    --gd-ok: #137333;
    --gd-warn: #b06000;
    --gd-danger: #c5221f;
    --gd-bot-bg: #eef3fb;
    --gd-user-bg: #003580;
}

html[data-theme="dark"] .igo-gd-root,
body.dark-mode .igo-gd-root {
    --gd-bg: #1e2128;
    --gd-bg2: #2a2f38;
    --gd-bg3: #343a46;
    --gd-border: rgba(255, 255, 255, 0.14);
    --gd-text: #e8eaed;
    --gd-muted: #9aa0a6;
    --gd-bot-bg: #243044;
    --gd-user-bg: #174ea6;
}

.igo-gd-fab {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: #003580;
    color: #fff;
    display: grid;
    place-items: center;
    position: relative;
}

.igo-gd-fab:hover {
    background: #174ea6;
}

.igo-gd-fab svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.igo-gd-fab.is-escort {
    background: #137333;
}

.igo-gd-fab.is-locked {
    background: #5f6368;
}

.igo-gd-fab-pulse {
    display: none;
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid #137333;
}

.igo-gd-fab.is-escort .igo-gd-fab-pulse {
    display: block;
    animation: igo-gd-pulse 1.8s ease-out infinite;
}

@keyframes igo-gd-pulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.28); opacity: 0; }
}

.igo-gd-panel {
    display: none;
    position: absolute;
    left: auto;
    right: 0;
    top: 48px;
    bottom: auto;
    width: min(360px, calc(100vw - 24px));
    height: min(420px, calc(100vh - var(--header-height, 64px) - 88px));
    max-width: calc(100vw - 16px);
    background: var(--gd-bg);
    color: var(--gd-text);
    border: 1px solid var(--gd-border);
    border-radius: 16px;
    overflow: hidden;
    flex-direction: column;
}

.igo-gd-root.is-open .igo-gd-panel {
    display: flex;
}

.igo-gd-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--gd-brand);
    color: #fff;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.igo-gd-head:active {
    cursor: grabbing;
}

.igo-gd-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #174ea6;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.igo-gd-avatar svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.igo-gd-head-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.igo-gd-head-text strong {
    font-size: 14px;
    font-weight: 700;
}

.igo-gd-head-text span {
    font-size: 11px;
    opacity: 0.88;
}

.igo-gd-online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #81c995;
    margin-right: 6px;
    vertical-align: 1px;
}

.igo-gd-head-btn {
    border: none;
    background: transparent;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.igo-gd-head-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.igo-gd-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--gd-bg);
}

.igo-gd-bubble {
    max-width: 88%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.igo-gd-bubble.bot {
    align-self: flex-start;
    background: var(--gd-bot-bg);
    color: var(--gd-text);
    border-bottom-left-radius: 4px;
}

.igo-gd-bubble.user {
    align-self: flex-end;
    background: var(--gd-user-bg);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.igo-gd-bubble.sys {
    align-self: center;
    background: var(--gd-bg2);
    color: var(--gd-muted);
    font-size: 12px;
    max-width: 94%;
}

.igo-gd-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: var(--gd-bot-bg);
    border-radius: 14px;
}

.igo-gd-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gd-muted);
    animation: igo-gd-dot 1.1s infinite ease-in-out;
}

.igo-gd-typing span:nth-child(2) { animation-delay: 0.15s; }
.igo-gd-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes igo-gd-dot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.igo-gd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 10px 6px;
    flex-shrink: 0;
    max-height: 72px;
    overflow-y: auto;
}

.igo-gd-chip {
    border: 1px solid var(--gd-border);
    background: var(--gd-bg2);
    color: var(--gd-text);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.igo-gd-chip:hover {
    border-color: var(--gd-accent);
    color: var(--gd-accent);
}

.igo-gd-chip.danger {
    border-color: #f6aea9;
    color: var(--gd-danger);
}

.igo-gd-footer {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--gd-border);
    background: var(--gd-bg);
    flex-shrink: 0;
}

.igo-gd-footer input {
    flex: 1;
    border: 1px solid var(--gd-border);
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    background: var(--gd-bg2);
    color: var(--gd-text);
    outline: none;
}

.igo-gd-footer input:focus {
    border-color: var(--gd-accent);
}

.igo-gd-mic,
.igo-gd-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--gd-brand);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.igo-gd-mic {
    background: var(--gd-bg3);
    color: var(--gd-brand);
}

.igo-gd-mic.is-on {
    background: var(--gd-danger);
    color: #fff;
}

.igo-gd-mic svg,
.igo-gd-send svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.igo-gd-send:disabled {
    opacity: 0.45;
    cursor: default;
}

.igo-gd-banner {
    display: none;
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10056;
    background: #137333;
    color: #fff;
    border-radius: 999px;
    padding: 8px 16px;
    font: 600 13px Roboto, system-ui, sans-serif;
    max-width: min(92vw, 420px);
    text-align: center;
}

.igo-gd-banner.show {
    display: block;
}

@media (max-width: 768px) {
    .igo-gd-root {
        top: calc(var(--header-height, 52px) + 6px);
        right: calc(max(8px, env(safe-area-inset-right)) + 48px);
    }
    .igo-gd-panel {
        position: fixed;
        max-width: calc(100vw - 16px);
    }
}
