/* static/css/help_widget.css — floating help chat bubble (peeks from the right edge) */

.hw {
    --hw-w: 56px;
    --hw-h: 52px;
    --hw-bottom: 7rem;
    --hw-fill: #5b4fcf;                       /* light theme: purple */
    --hw-shadow: rgba(91, 79, 207, .35);
    --hw-v: 9px;                              /* how many px of the bubble show */

    position: fixed;
    right: 0;
    bottom: calc(var(--hw-bottom) + env(safe-area-inset-bottom, 0px));
    z-index: 60;
}

[data-theme="dark"] .hw {
    --hw-fill: #fff;                          /* dark theme: white */
    --hw-shadow: rgba(0, 0, 0, .55);
}

/* Three resting states, driven by scrolling (see help_widget.js) */
.hw[data-state="rest"]    { --hw-v: 9px;  }   /* almost hidden */
.hw[data-state="settled"] { --hw-v: 22px; }   /* just a bit showing */
.hw[data-state="out"]     { --hw-v: 62px; }   /* fully out (intro, or card open) */

.hw-btn {
    display: block;
    width: var(--hw-w);
    height: var(--hw-h);
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    transform: translateX(calc(100% - var(--hw-v)));
    transition: transform .7s cubic-bezier(.3, 1.25, .5, 1);
    -webkit-tap-highlight-color: transparent;
}

/* Hover nudges it out a little; keyboard focus brings it fully out */
.hw[data-state="rest"] .hw-btn:hover,
.hw[data-state="settled"] .hw-btn:hover {
    transform: translateX(calc(100% - 32px));
}
.hw .hw-btn:focus-visible {
    transform: translateX(calc(100% - 62px));
    outline: 2px solid #a78bfa;
    outline-offset: 2px;
    border-radius: 12px;
}

.hw-btn svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    fill: var(--hw-fill);
    transform-origin: 20% 90%;
    filter: drop-shadow(0 4px 8px var(--hw-shadow));
}

/* Little wiggle each time it slides fully out */
.hw[data-state="out"] .hw-btn svg { animation: hw-wig 1.1s .3s ease-in-out 2; }
@keyframes hw-wig {
    0%, 100% { transform: rotate(0); }
    25%      { transform: rotate(-9deg); }
    60%      { transform: rotate(7deg); }
}

/* Contact card (small) */
.hw-panel {
    position: fixed;
    right: calc(var(--hw-w) + 14px);
    bottom: calc(var(--hw-bottom) + env(safe-area-inset-bottom, 0px));
    width: 232px;
    max-width: calc(100vw - var(--hw-w) - 28px);
    padding: 12px;
    background: var(--color-base-100, #fff);
    color: var(--color-base-content, #0f172a);
    border: 1px solid var(--color-base-300, #e5e7eb);
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(20, 16, 70, .2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(.97);
    transform-origin: bottom right;
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
}

.hw.is-open .hw-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.hw-title { margin: 0; font-size: 14px; font-weight: 700; }
.hw-sub   { margin: 1px 0 8px; font-size: 11.5px; opacity: .55; }

.hw-close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: 0;
    background: none;
    color: inherit;
    opacity: .5;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.hw-close:hover { opacity: 1; }

.hw-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    margin-top: 6px;
    border: 1px solid var(--color-base-300, #e5e7eb);
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    transition: border-color .2s ease, transform .2s ease;
}
.hw-item:hover { border-color: currentColor; transform: translateX(2px); }

.hw-ico {
    flex: none;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: inherit;
    opacity: .8;
}
.hw-ico svg { width: 20px; height: 20px; }
.hw-item:hover .hw-ico { opacity: 1; }

.hw-txt { min-width: 0; line-height: 1.3; }
.hw-txt b { display: block; font-size: 12.5px; }
.hw-txt small {
    display: block;
    font-size: 11px;
    opacity: .55;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .hw { --hw-w: 50px; --hw-h: 47px; --hw-bottom: 5.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .hw-btn, .hw-panel, .hw-item { transition: none; }
    .hw[data-state="out"] .hw-btn svg { animation: none; }
}