/* Estilos exclusivos do assistente: não modificam elementos do FoodTheme. */
#sg-chat-launch,#sg-chat {font-family:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;box-sizing:border-box;line-height:1.5;letter-spacing:normal;text-transform:none}
#sg-chat * {box-sizing:border-box}
#sg-chat-launch {position:fixed;right:22px;bottom:112px;z-index:1040;border:0;border-radius:40px;background:#c81d29;color:#fff;display:flex;align-items:center;gap:9px;padding:11px 14px 11px 10px;box-shadow:0 6px 24px #85121e40;cursor:pointer;text-align:left;transition:transform .18s}
#sg-chat-launch:hover {transform:translateY(-3px);background:#ad1420}
#sg-chat-launch strong,#sg-chat-launch small {display:block;color:#fff;line-height:1.3}
#sg-chat-launch small {font-size:11px;font-weight:400;opacity:.9}
#sg-chat-launch .sg-icon {width:36px;height:36px;background:#ffffff26;border-radius:50%;display:grid;place-items:center;font-size:19px}
#sg-chat {position:fixed;inset:auto 22px 22px auto;margin:0;padding:0;border:0;border-radius:24px;width:min(420px,calc(100vw - 32px));height:min(660px,calc(100dvh - 44px));max-width:none;max-height:none;background:#fff;color:#252128;box-shadow:0 18px 80px #30202038;overflow:hidden}
#sg-chat[open] {display:flex;flex-direction:column;animation:sg-enter .2s ease-out}
#sg-chat::backdrop {background:#20101755;backdrop-filter:blur(2px)}
#sg-chat .sg-head {display:flex;align-items:center;gap:12px;padding:19px 18px;background:linear-gradient(120deg,#a91122,#dc2632);color:white;flex:none}
#sg-chat .sg-avatar {width:47px;height:47px;border-radius:50%;background:#fff5dc;color:#b51a26;display:grid;place-items:center;flex:none;font-size:23px}
#sg-chat .sg-head h2 {font:700 17px/1.25 system-ui;margin:0;color:white;letter-spacing:0}
#sg-chat .sg-head p {font-size:12px;color:#fff3f3;margin:5px 0 0}
#sg-chat .sg-close {margin-left:auto;border:0;background:#ffffff23;color:white;border-radius:50%;height:34px;width:34px;font-size:23px;line-height:1;cursor:pointer;flex:none}
#sg-chat .sg-content {flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:21px 17px;background:#fbf8f4}
#sg-chat .sg-day {text-align:center;font-size:11px;color:#766c69;margin:0 0 20px}
#sg-chat .sg-msg {display:flex;gap:8px;align-items:flex-end;margin:0 0 15px}
#sg-chat .sg-msg.sg-user {justify-content:flex-end}
#sg-chat .sg-mini {width:27px;height:27px;border-radius:50%;background:#f9e4bd;color:#a81825;display:grid;place-items:center;flex:none;font-size:12px}
#sg-chat .sg-bubble {max-width:85%;padding:11px 14px;border:1px solid #eee6df;border-radius:16px 16px 16px 4px;background:white;font-size:14px;white-space:pre-wrap;overflow-wrap:anywhere;box-shadow:0 2px 5px #4d2d1208}
#sg-chat .sg-user .sg-bubble {background:#b91b2a;color:white;border-color:#b91b2a;border-radius:16px 16px 4px 16px}
#sg-chat .sg-time {display:block;font-size:10px;opacity:.72;margin-top:5px;text-align:right}
#sg-chat .sg-suggestions {display:flex;flex-wrap:wrap;gap:7px;margin:0 0 16px 35px}
#sg-chat .sg-suggestions button {background:white;color:#a91927;border:1px solid #e9c7c7;border-radius:20px;padding:8px 11px;font:600 12px system-ui;cursor:pointer}
#sg-chat .sg-suggestions button:hover {background:#fff0ee}
#sg-chat button:disabled {opacity:.45;cursor:not-allowed}
#sg-chat .sg-note {text-align:center;font-size:10px;color:#746d69;margin:9px 0 0}
#sg-chat .sg-error {font-size:12px;color:#a91725;margin:0 0 8px;overflow-wrap:anywhere}
#sg-chat [hidden] {display:none!important}
#sg-chat .sg-dots span {display:inline-block;width:7px;height:7px;border-radius:50%;background:#b58a85;margin:0 2px;animation:sg-pulse 1.2s infinite}
#sg-chat .sg-dots span:nth-child(2) {animation-delay:.15s} #sg-chat .sg-dots span:nth-child(3) {animation-delay:.3s}
@keyframes sg-pulse {0%,70%,100%{opacity:.4;transform:translateY(0)}35%{opacity:1;transform:translateY(-4px)}}
@keyframes sg-enter {from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:990px){#sg-chat-launch{bottom:calc(82px + env(safe-area-inset-bottom));right:12px;padding:9px 11px 9px 8px}}
@media(max-width:560px){#sg-chat{inset:0;margin:0;width:100%;height:100dvh;border-radius:0}#sg-chat .sg-head{padding-top:calc(15px + env(safe-area-inset-top))}#sg-chat .sg-compose{padding-bottom:calc(10px + env(safe-area-inset-bottom))}}
@media(prefers-reduced-motion:reduce){#sg-chat *,#sg-chat,#sg-chat-launch{animation:none!important;transition:none!important}}



/* Barra de composição inspirada no WhatsApp: ícones embutidos e ação à direita. */
#sg-chat .sg-compose {background:#f0f2f5;padding:10px 12px 9px;border-top:1px solid #e2ded9;flex:none}
#sg-chat .sg-media-preview-host {margin:0 0 8px}
#sg-chat .sg-media-preview-host[hidden] {display:none!important}
#sg-chat .sg-form {display:flex;align-items:flex-end;gap:6px;border:1px solid #dde2e7;border-radius:28px;padding:4px 8px;background:#fff;min-height:56px}
#sg-chat .sg-form:focus-within {border-color:#bfc6cc;box-shadow:none}
#sg-chat .sg-media-host {display:flex;align-items:center;gap:2px;flex:none}
#sg-chat .sg-media-tools {display:flex;gap:2px;align-items:center;flex-wrap:nowrap;margin:0}
#sg-chat .sg-media-button {display:inline-flex;align-items:center;justify-content:center;border:0;background:transparent;color:#54656f;border-radius:50%;width:40px;height:40px;min-width:40px;padding:0;cursor:pointer}
#sg-chat .sg-media-button:hover {background:#f1f3f5}
#sg-chat .sg-media-button:disabled {opacity:.42;cursor:not-allowed;background:transparent}
#sg-chat .sg-media-info {font-size:12px;color:#54656f;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:150px}
#sg-chat textarea {resize:none;flex:1;min-width:0;min-height:24px;max-height:120px;padding:13px 6px 12px;border:0!important;outline:0!important;box-shadow:none!important;background:transparent;font:14px/1.45 system-ui;color:#252128}
#sg-chat .sg-send {width:44px;height:44px;flex:none;background:#00a884;color:#fff;border:0;border-radius:50%;cursor:pointer;font-size:17px;display:inline-flex;align-items:center;justify-content:center}
#sg-chat .sg-send:hover {background:#019477}
#sg-chat .sg-bubble audio {min-width:0}

/* Orçamentos dentro da conversa: layout adaptável à largura do celular. */
#sg-chat .sg-product-plan{white-space:normal;margin-top:10px;min-width:0;width:100%;font-size:13px}
#sg-chat .sg-plan-title{font-weight:700;margin:4px 0 8px}
#sg-chat .sg-product-card{border:1px solid #e9dedb;border-radius:12px;padding:9px;margin:8px 0;background:#fff;min-width:0}
#sg-chat .sg-product-top{display:flex;align-items:center;gap:9px;min-width:0}
#sg-chat .sg-product-top img{width:68px;height:68px;object-fit:cover;border-radius:8px;flex-shrink:0}
#sg-chat .sg-product-info{min-width:0;flex:1}
#sg-chat .sg-product-name{color:#572420;font-weight:700;text-decoration:underline;overflow-wrap:anywhere}
#sg-chat .sg-product-price{color:#a8192a;font-weight:600;margin-top:4px}
#sg-chat .sg-product-controls{display:flex;align-items:center;flex-wrap:wrap;gap:7px;margin-top:10px}
#sg-chat .sg-product-controls button{border:1px solid #ddd;background:#fff;border-radius:50%;width:28px;height:28px;padding:0;font-size:17px;color:#333;cursor:pointer;line-height:1}
#sg-chat .sg-product-controls button:disabled{opacity:.45;cursor:default}
#sg-chat .sg-product-controls strong{margin-left:auto}
#sg-chat .sg-product-units,#sg-chat .sg-plan-note{color:#666;font-size:11px;display:block;margin-top:4px}
#sg-chat .sg-product-link,#sg-chat .sg-plan-toggle{display:block;text-align:center;border-radius:8px;padding:8px;font-weight:600;margin-top:8px;width:100%;box-sizing:border-box;white-space:normal}
#sg-chat .sg-product-link{background:#b91b2a;text-decoration:none}
/* A cor global de links do tema não deve afetar o botão de compra. */
#sg-chat a.sg-product-link,#sg-chat a.sg-product-link:link,#sg-chat a.sg-product-link:visited,#sg-chat a.sg-product-link:hover,#sg-chat a.sg-product-link:active,#sg-chat a.sg-product-link:focus{color:#fff!important}
#sg-chat .sg-plan-toggle{border:1px solid #b91b2a;background:white;color:#a8192a;cursor:pointer}
#sg-chat .sg-plan-total{font-weight:700;margin-top:10px;color:#a8192a}
#sg-chat .sg-bubble:has(.sg-product-plan){width:85%;max-width:85%}

/* Reflexo luminoso: uma faixa diagonal atravessa o botão sem alterar
   suas dimensões. O efeito fica restrito ao botão e roda em loop. */
#sg-chat-launch[aria-expanded="false"] {
    overflow: hidden;
    animation: none !important;
}
#sg-chat-launch[aria-expanded="false"]::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -45%;
    width: 28%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.48), transparent);
    transform: skewX(-22deg);
    pointer-events: none;
    animation: sg-launch-shine 3s linear infinite;
}
@keyframes sg-launch-shine {
    0% { left: -45%; }
    48%, 100% { left: 115%; }
}
@media (prefers-reduced-motion: reduce) {
    #sg-chat-launch[aria-expanded="false"]::after { animation: none; display: none; }
}


/* Teclado virtual: o diálogo acompanha a área realmente visível.
   Cabeçalho e composição permanecem fixos; só o histórico encolhe. */
@media (max-width: 560px), (pointer: coarse) {
    #sg-chat textarea { font-size: 16px; } /* Evita zoom automático no iOS. */
    #sg-chat.sg-visual-viewport[open] {
        inset: auto;
        top: calc(var(--sg-vv-top) + max(0px, var(--sg-vv-height) - 682px));
        left: calc(var(--sg-vv-left) + max(0px, var(--sg-vv-width) - 442px));
        width: min(420px, var(--sg-vv-width));
        height: min(660px, var(--sg-vv-height));
        animation: none;
    }
}
@media (max-width: 560px) {
    #sg-chat { height: 100vh; height: 100dvh; }
    #sg-chat.sg-visual-viewport[open] {
        top: var(--sg-vv-top);
        left: var(--sg-vv-left);
        width: var(--sg-vv-width);
        height: var(--sg-vv-height);
    }
}
