#bcw-wrap {
    position: fixed;
    bottom: 24px;
    z-index: 999999;
    font-family: 'Raleway', sans-serif;
    --bcw-accent-rgb: 38, 170, 226;
}

#bcw-wrap.bcw--left  { left: 24px; }
#bcw-wrap.bcw--right { right: 24px; }

/* ── Trigger button ─────────────────────────────────────────────── */
/* Visibility is toggled with the .bcw-shown class (added/removed continuously
   on scroll), not [hidden] — this lets it fade in AND back out. */

#bcw-trigger {
    display: flex;
    align-items: center;
    gap: 11px;
    background: var(--bcw-accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 15px 28px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    transition: transform .45s cubic-bezier(.34, 1.56, .64, 1),
                opacity .3s ease,
                visibility .3s ease,
                box-shadow .15s ease;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(40px);
}
#bcw-trigger.bcw-shown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
#bcw-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}
#bcw-trigger.bcw-shown:hover { transform: translateY(-2px); }
#bcw-trigger:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}
#bcw-trigger svg { width: 21px; height: 21px; flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) {
    #bcw-trigger { transition: opacity .01s linear; transform: none; }
}

/* One-time attention pulse (never loops, respects reduced-motion) */
#bcw-trigger.bcw-pulse {
    animation: bcw-pulse-ring 1.6s ease-out 2;
}
@keyframes bcw-pulse-ring {
    0%   { box-shadow: 0 6px 18px rgba(0,0,0,0.18), 0 0 0 0 rgba(var(--bcw-accent-rgb), 0.55); }
    70%  { box-shadow: 0 6px 18px rgba(0,0,0,0.18), 0 0 0 14px rgba(var(--bcw-accent-rgb), 0); }
    100% { box-shadow: 0 6px 18px rgba(0,0,0,0.18), 0 0 0 0 rgba(var(--bcw-accent-rgb), 0); }
}
@media (prefers-reduced-motion: reduce) {
    #bcw-trigger.bcw-pulse { animation: none; }
}

/* Keep the trigger clickable-hidden (not display:none) while the panel is
   open, so closing the panel doesn't require the scroll state to recompute. */
#bcw-wrap.bcw-open #bcw-trigger { opacity: 0; visibility: hidden; pointer-events: none; }

/* ── Panel ───────────────────────────────────────────────────────── */

#bcw-panel {
    position: absolute;
    bottom: 0;
    width: min(380px, calc(100vw - 32px));
    height: min(640px, calc(100vh - 96px));   /* a real height, not just a
        cap — max-height alone lets children grow past the viewport
        with nothing to actually scroll them, which is what was cutting
        the submit button off with no way to reach it */
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: bcw-panel-in .22s ease-out;
}
.bcw--left  #bcw-panel { left: 0; }
.bcw--right #bcw-panel { right: 0; }

@keyframes bcw-panel-in {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    #bcw-panel { animation: none; }
}

#bcw-panel[hidden] { display: none !important; }

#bcw-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bcw-accent);
    color: #fff;
    padding: 16px 18px;
    flex-shrink: 0;
}
#bcw-panel-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
#bcw-panel-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}
#bcw-panel-icon svg { width: 16px; height: 16px; }
#bcw-panel-title {
    font-weight: 700;
    font-size: 16px;
}
#bcw-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}
#bcw-close:hover { background: rgba(255, 255, 255, 0.28); }
#bcw-close svg { width: 16px; height: 16px; }

#bcw-panel-subheading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 18px 0;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--bcw-accent);
    background: rgba(var(--bcw-accent-rgb), 0.09);
    border-radius: 10px;
    flex-shrink: 0;
}
#bcw-panel-subheading svg { width: 15px; height: 15px; flex-shrink: 0; }

#bcw-form-wrap {
    padding: 10px 14px 16px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;   /* the fix: lets this box actually shrink and scroll
                         instead of pushing the submit button out of view */
    -webkit-overflow-scrolling: touch;
}

#bcw-panel-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 12px 18px;
    border-top: 1px solid #eef0f2;
    background: #fafbfc;
    flex-shrink: 0;
}
.bcw-alt-contact {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #475467;
    text-decoration: none;
}
.bcw-alt-contact svg { width: 15px; height: 15px; color: var(--bcw-accent); flex-shrink: 0; }
.bcw-alt-contact:hover { color: var(--bcw-accent); }

/* Mobile: full-width sheet rather than a floating card */
@media (max-width: 480px) {
    #bcw-wrap { left: 0; right: 0; bottom: 0; }
    #bcw-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 80vh;      /* real height again, same reasoning as above */
        border-radius: 16px 16px 0 0;
    }
    #bcw-wrap.bcw--left  #bcw-trigger,
    #bcw-wrap.bcw--right #bcw-trigger { position: fixed; bottom: 16px; }
    #bcw-wrap.bcw--left  #bcw-trigger { left: 16px; }
    #bcw-wrap.bcw--right #bcw-trigger { right: 16px; }
}
