/* ============================================================
   SG Organic BARRY Chatbot — V1.0.4
   Cleaner commerce UI, fewer green buttons, fixed launcher/input
   ============================================================ */

#sgoc-chat-widget {
    --sgo-primary: #3a1f7f;
    --sgo-white: #ffffff;
    --sgo-dark: #1E0C48;
    --sgo-violet: #7C54DE;
    --sgo-green: #4D9E2C;
    --sgo-green-2: #478F29;
    --sgo-forest: #30631B;
    --sgo-ink: #101414;
    --sgo-muted: rgba(16,20,20,.62);
    --sgo-border: rgba(255,255,255,.66);
    --sgo-shadow: 0 22px 70px rgba(30,12,72,.18), 0 10px 34px rgba(48,99,27,.12);
    position: fixed;
    z-index: 2147482900;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--sgo-ink);
}

#sgoc-chat-widget *,
#sgoc-chat-widget *::before,
#sgoc-chat-widget *::after { box-sizing: border-box; }

#sgoc-chat-widget.bottom-right { right: 18px; bottom: 18px; }
#sgoc-chat-widget.bottom-left { left: 18px; bottom: 18px; }

#sgoc-chat-widget .sgoc-bubble {
    width: 238px;
    max-width: calc(100vw - 32px);
    min-height: 58px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    padding: 7px 12px 7px 7px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #fff;
    background:
        radial-gradient(circle at 8% 14%, rgba(124,84,222,.32), transparent 30%),
        linear-gradient(135deg, #06351d 0%, #04301a 60%, #1E0C48 130%);
    box-shadow: 0 14px 38px rgba(6,53,29,.28), inset 0 0 0 1px rgba(77,158,44,.24);
    transition: transform .2s ease, opacity .2s ease, box-shadow .2s ease;
    position: relative;
}

#sgoc-chat-widget .sgoc-bubble.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(.96);
}

#sgoc-chat-widget .sgoc-bubble:hover {
    transform: translateY(-2px);
}

#sgoc-chat-widget .sgoc-launch-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #fff;
    border: 2px solid rgba(255,255,255,.78);
    box-shadow: 0 8px 18px rgba(0,0,0,.16);
    font-size: 22px;
}

#sgoc-chat-widget .sgoc-launch-avatar img { width: 100%; height: 100%; object-fit: cover; }

#sgoc-chat-widget .sgoc-launch-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: left;
}

#sgoc-chat-widget .sgoc-launch-copy strong {
    font-size: 15px;
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -.01em;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sgoc-chat-widget .sgoc-launch-copy em {
    margin-top: 2px;
    font-style: normal;
    font-size: 11px;
    line-height: 1.2;
    color: rgba(255,255,255,.70);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sgoc-chat-widget .sgoc-launch-chevron {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    color: #8fff66;
    transition: transform .2s ease;
}

#sgoc-chat-widget .sgoc-launch-chevron.is-open { transform: rotate(180deg); }

#sgoc-chat-widget .sgoc-badge {
    position: absolute;
    top: -4px;
    right: 5px;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ff4d4d;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border: 2px solid #fff;
}

#sgoc-chat-widget .sgoc-panel {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: min(400px, calc(100vw - 24px));
    height: min(640px, calc(100vh - 98px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 28px;
    background:
        radial-gradient(circle at 8% 10%, rgba(124,84,222,.16), transparent 30%),
        radial-gradient(circle at 96% 12%, rgba(77,158,44,.22), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,.76));
    backdrop-filter: blur(28px) saturate(1.3);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    border: 1px solid var(--sgo-border);
    box-shadow: var(--sgo-shadow);
    animation: sgoc-panel-in .22s cubic-bezier(.2,.9,.2,1);
    isolation: isolate;
}

#sgoc-chat-widget.bottom-left .sgoc-panel { left: 0; right: auto; }

@keyframes sgoc-panel-in {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

#sgoc-chat-widget .sgoc-bg-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(32px);
    pointer-events: none;
    z-index: -1;
}

#sgoc-chat-widget .sgoc-bg-orb-one {
    width: 190px; height: 190px; top: -72px; right: -72px;
    background: rgba(77,158,44,.22);
}

#sgoc-chat-widget .sgoc-bg-orb-two {
    width: 230px; height: 230px; bottom: 52px; left: -105px;
    background: rgba(124,84,222,.13);
}

#sgoc-chat-widget .sgoc-header {
    padding: 12px 12px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    flex: 0 0 auto;
}

#sgoc-chat-widget .sgoc-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

#sgoc-chat-widget .sgoc-back-btn,
#sgoc-chat-widget .sgoc-home-btn {
    border: 1px solid rgba(255,255,255,.78);
    background: rgba(255,255,255,.60);
    color: var(--sgo-dark);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
    transition: transform .16s ease, background .16s ease;
}

#sgoc-chat-widget .sgoc-back-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
}

#sgoc-chat-widget .sgoc-home-btn {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    overflow: hidden;
}

#sgoc-chat-widget .sgoc-home-btn img { width: 100%; height: 100%; object-fit: cover; }
#sgoc-chat-widget .sgoc-home-btn span { font-size: 21px; }

#sgoc-chat-widget .sgoc-header-info strong {
    display: block;
    font-size: 17px;
    line-height: 1.05;
    letter-spacing: -.02em;
    color: var(--sgo-ink);
}

#sgoc-chat-widget .sgoc-status {
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--sgo-muted);
    white-space: nowrap;
}

#sgoc-chat-widget .sgoc-status i {
    width: 8px; height: 8px; border-radius: 999px;
    background: #4D9E2C;
    box-shadow: 0 0 0 4px rgba(77,158,44,.16);
}

#sgoc-chat-widget .sgoc-header-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

#sgoc-chat-widget .sgoc-whatsapp-btn,
#sgoc-chat-widget .sgoc-close-btn {
    width: 36px; height: 36px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,.78);
    background: rgba(255,255,255,.54);
    color: var(--sgo-dark);
    display: grid; place-items: center;
    text-decoration: none; cursor: pointer;
    padding: 0; line-height: 0;
    transition: transform .16s ease, background .16s ease;
}

#sgoc-chat-widget .sgoc-whatsapp-btn { color: var(--sgo-forest); }

#sgoc-chat-widget .sgoc-whatsapp-btn:hover,
#sgoc-chat-widget .sgoc-close-btn:hover,
#sgoc-chat-widget .sgoc-home-btn:hover,
#sgoc-chat-widget .sgoc-back-btn:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,.88);
}

#sgoc-chat-widget .sgoc-home-screen {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 14px 12px;
}

#sgoc-chat-widget .sgoc-welcome {
    margin: 0 0 12px;
    padding: 16px;
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.68), rgba(255,255,255,.38)),
        radial-gradient(circle at 92% 18%, rgba(77,158,44,.11), transparent 36%);
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 12px 24px rgba(30,12,72,.05);
}

#sgoc-chat-widget .sgoc-welcome-pill {
    display: inline-flex;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.72);
    color: rgba(30,12,72,.70);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

#sgoc-chat-widget .sgoc-welcome h3 {
    margin: 10px 0 5px;
    font-size: clamp(23px, 6vw, 30px);
    line-height: 1;
    letter-spacing: -.05em;
    color: var(--sgo-ink);
}

#sgoc-chat-widget .sgoc-welcome p {
    margin: 0;
    color: var(--sgo-muted);
    font-size: 13.5px;
}

#sgoc-chat-widget .sgoc-home-chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-bottom: 8px;
}

#sgoc-chat-widget .sgoc-home-chip {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(255,255,255,.78);
    background: rgba(255,255,255,.66);
    color: var(--sgo-dark);
    border-radius: 999px;
    padding: 9px 10px;
    font-size: 11.5px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(30,12,72,.045);
    transition: transform .16s ease, background .16s ease, color .16s ease;
    white-space: normal;
    text-align: center;
}

#sgoc-chat-widget .sgoc-home-chip:hover {
    transform: translateY(-1px);
    background: #fff;
    color: var(--sgo-primary);
}

#sgoc-chat-widget .sgoc-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

#sgoc-chat-widget .sgoc-messages::-webkit-scrollbar,
#sgoc-chat-widget .sgoc-home-screen::-webkit-scrollbar { width: 4px; }

#sgoc-chat-widget .sgoc-messages::-webkit-scrollbar-thumb,
#sgoc-chat-widget .sgoc-home-screen::-webkit-scrollbar-thumb {
    background: rgba(48,99,27,.18);
    border-radius: 99px;
}

#sgoc-chat-widget .sgoc-bot-stack {
    align-self: flex-start;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

#sgoc-chat-widget .sgoc-msg {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 19px;
    font-size: 14px;
    line-height: 1.46;
    word-break: break-word;
}

#sgoc-chat-widget .sgoc-msg-bot {
    align-self: flex-start;
    color: var(--sgo-ink);
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(255,255,255,.72);
    border-bottom-left-radius: 8px;
    box-shadow: 0 10px 22px rgba(30,12,72,.045);
}

#sgoc-chat-widget .sgoc-msg-user {
    align-self: flex-end;
    color: white;
    background: linear-gradient(135deg, #4D9E2C, #30631B);
    border: 1px solid rgba(255,255,255,.20);
    border-bottom-right-radius: 8px;
    box-shadow: 0 12px 24px rgba(48,99,27,.16);
}

#sgoc-chat-widget .sgoc-typing {
    width: fit-content;
    display: flex;
    gap: 5px;
    padding: 12px 14px;
    border-radius: 19px;
    border-bottom-left-radius: 8px;
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(255,255,255,.72);
}

#sgoc-chat-widget .sgoc-typing span {
    width: 7px; height: 7px; border-radius: 999px;
    background: rgba(30,12,72,.36);
    animation: sgoc-bounce 1.2s infinite ease-in-out;
}

#sgoc-chat-widget .sgoc-typing span:nth-child(2) { animation-delay: .16s; }
#sgoc-chat-widget .sgoc-typing span:nth-child(3) { animation-delay: .32s; }

@keyframes sgoc-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .45; }
    40% { transform: translateY(-4px); opacity: 1; }
}

#sgoc-chat-widget .sgoc-products { display: flex; flex-direction: column; gap: 9px; }

#sgoc-chat-widget .sgoc-product-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 9px;
    border-radius: 19px;
    background: rgba(255,255,255,.80);
    border: 1px solid rgba(255,255,255,.74);
    box-shadow: 0 10px 22px rgba(30,12,72,.045);
}

#sgoc-chat-widget .sgoc-product-img {
    width: 54px; height: 54px; border-radius: 15px;
    overflow: hidden;
    display: grid; place-items: center;
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(30,12,72,.08);
    color: var(--sgo-green);
    font-size: 21px;
}

#sgoc-chat-widget .sgoc-product-img img { width: 100%; height: 100%; object-fit: cover; }
#sgoc-chat-widget .sgoc-product-img.is-placeholder { background: rgba(255,255,255,.72); }

#sgoc-chat-widget .sgoc-product-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#sgoc-chat-widget .sgoc-product-name {
    font-size: 13px;
    color: var(--sgo-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sgoc-chat-widget .sgoc-product-vendor {
    font-size: 11px;
    color: var(--sgo-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sgoc-chat-widget .sgoc-product-price {
    font-size: 13px;
    font-weight: 900;
    color: var(--sgo-green-2);
}

#sgoc-chat-widget .sgoc-out-of-stock {
    font-size: 11px;
    font-style: normal;
    color: #d33;
}

#sgoc-chat-widget .sgoc-product-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#sgoc-chat-widget .sgoc-product-add,
#sgoc-chat-widget .sgoc-product-view,
#sgoc-chat-widget .sgoc-action-btn {
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 900;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .16s ease, opacity .16s ease, background .16s ease;
}

#sgoc-chat-widget .sgoc-product-add {
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, #478F29, #30631B);
    box-shadow: 0 8px 16px rgba(48,99,27,.12);
}

#sgoc-chat-widget .sgoc-product-view,
#sgoc-chat-widget .sgoc-action-btn {
    color: var(--sgo-dark);
    background: rgba(255,255,255,.70);
    border: 1px solid rgba(30,12,72,.12);
}

#sgoc-chat-widget .sgoc-action-btn:hover,
#sgoc-chat-widget .sgoc-product-add:hover,
#sgoc-chat-widget .sgoc-product-view:hover {
    transform: translateY(-1px);
    opacity: .94;
}

#sgoc-chat-widget .sgoc-product-add:disabled,
#sgoc-chat-widget .sgoc-action-btn:disabled {
    opacity: .58;
    cursor: wait;
}

#sgoc-chat-widget .sgoc-recipe-card,
#sgoc-chat-widget .sgoc-missing {
    padding: 12px;
    border-radius: 18px;
    background: rgba(255,255,255,.74);
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 10px 20px rgba(30,12,72,.04);
}

#sgoc-chat-widget .sgoc-recipe-card { display: flex; flex-direction: column; gap: 4px; }
#sgoc-chat-widget .sgoc-recipe-card strong { font-size: 14px; }

#sgoc-chat-widget .sgoc-recipe-card span,
#sgoc-chat-widget .sgoc-recipe-card a,
#sgoc-chat-widget .sgoc-missing small {
    font-size: 12px;
    color: var(--sgo-muted);
}

#sgoc-chat-widget .sgoc-recipe-card a { color: var(--sgo-primary); font-weight: 900; }
#sgoc-chat-widget .sgoc-missing strong { display: block; margin-bottom: 6px; font-size: 13px; }
#sgoc-chat-widget .sgoc-missing ul { margin: 0 0 6px; padding-left: 18px; }
#sgoc-chat-widget .sgoc-missing li { font-size: 12px; color: var(--sgo-muted); }

#sgoc-chat-widget .sgoc-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

#sgoc-chat-widget .sgoc-chips { display: none !important; }

#sgoc-chat-widget .sgoc-input-shell {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    align-items: center;
    gap: 8px;
    margin: 0 14px 10px;
    padding: 8px;
    border-radius: 24px;
    background: rgba(255,255,255,.84);
    border: 1px solid rgba(255,255,255,.80);
    box-shadow: 0 12px 30px rgba(30,12,72,.055);
}

#sgoc-chat-widget .sgoc-input {
    width: 100%;
    height: 38px !important;
    min-height: 38px;
    max-height: 38px;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 8px 8px;
    font: inherit;
    font-size: 14px;
    line-height: 22px;
    color: var(--sgo-ink);
    overflow: hidden !important;
    scrollbar-width: none;
}

#sgoc-chat-widget .sgoc-input::-webkit-scrollbar { display: none; }
#sgoc-chat-widget .sgoc-input::placeholder { color: rgba(16,20,20,.42); }

#sgoc-chat-widget .sgoc-send-btn {
    width: 42px; height: 42px; border-radius: 999px;
    border: 0;
    display: grid; place-items: center;
    cursor: pointer;
    background: linear-gradient(135deg, var(--sgo-primary), var(--sgo-dark));
    color: #fff;
    box-shadow: 0 10px 22px rgba(30,12,72,.18);
    transition: transform .16s ease, opacity .16s ease;
    padding: 0; line-height: 0;
}

#sgoc-chat-widget .sgoc-send-btn:hover { transform: translateY(-1px) scale(1.02); }
#sgoc-chat-widget .sgoc-send-btn:disabled { opacity: .55; cursor: wait; }

#sgoc-chat-widget .sgoc-footer-note {
    flex: 0 0 auto;
    padding: 0 14px 12px;
    text-align: center;
    font-size: 11px;
    color: rgba(30,12,72,.40);
}

#sgoc-chat-widget .sgoc-footer-note a {
    color: rgba(30,12,72,.46);
    text-decoration: none;
}

@media (max-width: 520px) {
    #sgoc-chat-widget.bottom-right,
    #sgoc-chat-widget.bottom-left { right: 0; left: 0; bottom: 0; }

    #sgoc-chat-widget .sgoc-bubble {
        position: fixed;
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
        min-height: 58px;
        grid-template-columns: 42px minmax(0, 1fr) 18px;
    }

    #sgoc-chat-widget.bottom-left .sgoc-bubble { right: 12px; left: 12px; }

    #sgoc-chat-widget .sgoc-launch-avatar { width: 42px; height: 42px; }
    #sgoc-chat-widget .sgoc-launch-copy strong { font-size: 15px; }
    #sgoc-chat-widget .sgoc-launch-copy em { font-size: 11px; }

    #sgoc-chat-widget .sgoc-panel {
        position: fixed;
        inset: auto 8px 8px 8px;
        width: auto;
        height: min(82vh, 680px);
        border-radius: 26px;
        bottom: 8px;
    }

    #sgoc-chat-widget .sgoc-header { padding: 11px 11px 8px; }
    #sgoc-chat-widget .sgoc-back-btn { width: 32px; height: 32px; }
    #sgoc-chat-widget .sgoc-home-btn { width: 40px; height: 40px; border-radius: 14px; }
    #sgoc-chat-widget .sgoc-whatsapp-btn,
    #sgoc-chat-widget .sgoc-close-btn { width: 34px; height: 34px; }
    #sgoc-chat-widget .sgoc-status { font-size: 11px; }
    #sgoc-chat-widget .sgoc-welcome { padding: 14px; border-radius: 22px; }

    #sgoc-chat-widget .sgoc-home-chips {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    #sgoc-chat-widget .sgoc-home-chip {
        min-height: 42px;
        padding: 9px 8px;
        font-size: 11px;
    }

    #sgoc-chat-widget .sgoc-product-card { grid-template-columns: 50px minmax(0, 1fr); }

    #sgoc-chat-widget .sgoc-product-actions {
        grid-column: 1 / -1;
        flex-direction: row;
    }

    #sgoc-chat-widget .sgoc-product-add,
    #sgoc-chat-widget .sgoc-product-view { flex: 1; }
}

@media (max-width: 380px) {
    #sgoc-chat-widget .sgoc-panel {
        inset: auto 6px 6px 6px;
        height: min(84vh, 660px);
    }

    #sgoc-chat-widget .sgoc-header-info { gap: 6px; }
    #sgoc-chat-widget .sgoc-header-info strong { font-size: 15px; }

    #sgoc-chat-widget .sgoc-status {
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #sgoc-chat-widget .sgoc-home-chips { grid-template-columns: 1fr; }
}

@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
    #sgoc-chat-widget .sgoc-panel,
    #sgoc-chat-widget .sgoc-input-shell,
    #sgoc-chat-widget .sgoc-msg-bot,
    #sgoc-chat-widget .sgoc-product-card {
        background: rgba(255,255,255,.96);
    }
}

#sgoc-chat-widget .sgoc-bot-stack:empty {
    display: none;
}


/* V1.0.7 cleanup */
#sgoc-chat-widget .sgoc-action-btn {
    background: rgba(255,255,255,.78) !important;
    color: var(--sgo-dark) !important;
    border: 1px solid rgba(30,12,72,.12) !important;
    box-shadow: 0 8px 18px rgba(30,12,72,.04) !important;
}

#sgoc-chat-widget .sgoc-product-add {
    background: linear-gradient(135deg, #478F29, #30631B) !important;
}

#sgoc-chat-widget .sgoc-actions {
    max-width: 100%;
    overflow: visible;
}

#sgoc-chat-widget .sgoc-missing {
    opacity: .92;
}
