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

/* ── Backdrop ── */
#hp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 8998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
#hp-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Pill bubble ── */
#hp-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px 11px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    cursor: pointer;
    z-index: 9001;
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    transition: box-shadow 0.18s, transform 0.18s;
}
#hp-bubble:hover { box-shadow: 0 6px 22px rgba(0,0,0,0.16); transform: translateY(-1px); }
#hp-bubble:active { transform: scale(0.97); }
.hp-bubble-icon { width: 18px; height: 18px; fill: #4F46E5; flex-shrink: 0; }

/* ── Panel ── */
#hp-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    height: min(620px, calc(100vh - 48px));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: hp-in 0.2s cubic-bezier(0.4,0,0.2,1) both;
}
#hp-panel[hidden] { display: none; }

@keyframes hp-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

/* ── Header ── */
.hp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 14px;
    flex-shrink: 0;
}
.hp-header-title { font-size: 0.95rem; font-weight: 600; color: #111827; }
.hp-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.12s, background 0.12s;
}
.hp-close:hover { color: #374151; background: #f3f4f6; }

/* ── Body ── */
.hp-body { flex: 1; overflow: hidden; min-height: 0; }

.hp-pane { display: none; flex-direction: column; height: 100%; overflow-y: auto; }
.hp-pane.is-active { display: flex; }

/* ── Home pane ── */
#hp-pane-home { justify-content: space-between; overflow: hidden; }

.hp-home-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 20px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.hp-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #4F46E5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    flex-shrink: 0;
}
.hp-avatar svg { width: 28px; height: 28px; fill: #fff; }

.hp-greeting {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 5px;
    text-align: center;
}
.hp-subtitle {
    font-size: 0.84rem;
    color: #6b7280;
    margin: 0 0 20px;
    text-align: center;
}

/* Pills */
.hp-pills {
    display: flex;
    gap: 8px;
    width: 100%;
    padding-bottom: 4px;
}
.hp-pill {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.hp-pill svg { width: 15px; height: 15px; fill: #4F46E5; flex-shrink: 0; }
.hp-pill:hover { border-color: #a5b4fc; background: #f5f3ff; }

/* Bottom section — textarea pinned to bottom */
.hp-home-bottom {
    flex-shrink: 0;
    padding: 12px 16px 14px;
    border-top: 1px solid #f3f4f6;
}
.hp-composer { position: relative; }
#hp-text {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 44px 10px 12px;
    font-size: 0.84rem;
    font-family: inherit;
    color: #111827;
    background: #f9fafb;
    resize: none;
    outline: none;
    line-height: 1.45;
    transition: border-color 0.15s, background 0.15s;
    display: block;
}
#hp-text:focus { border-color: #4F46E5; background: #fff; }
#hp-text::placeholder { color: #9ca3af; }

.hp-send {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #4F46E5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.hp-send:hover { background: #4338ca; }
.hp-send svg { width: 14px; height: 14px; fill: #fff; }

.hp-powered {
    margin: 8px 0 0;
    font-size: 0.72rem;
    color: #9ca3af;
    text-align: center;
}
.hp-powered strong { color: #6b7280; font-weight: 500; }

/* ── Conversations empty state ── */
.hp-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #9ca3af;
    font-size: 0.84rem;
    padding: 24px;
    text-align: center;
}
.hp-empty-state svg { width: 36px; height: 36px; fill: #d1d5db; }

/* ── FAQ pane — modern design ── */
#hp-pane-faq { overflow-y: auto; }

.hp-faq-group { margin-bottom: 4px; }

.hp-faq-group-label {
    padding: 14px 16px 6px;
    font-size: 0.69rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9ca3af;
}

.hp-qi { border-top: 1px solid #f3f4f6; }
.hp-qi:last-child { border-bottom: 1px solid #f3f4f6; }

.hp-qi-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}
.hp-qi-btn:hover { background: #fafafa; }
.hp-qi-btn[aria-expanded="true"] { background: #f5f3ff; }

.hp-qi-q {
    font-size: 0.84rem;
    font-weight: 500;
    color: #374151;
    line-height: 1.4;
    flex: 1;
}
.hp-qi-btn[aria-expanded="true"] .hp-qi-q { color: #4F46E5; }

.hp-qi-arrow {
    width: 15px;
    height: 15px;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
}
.hp-qi-btn[aria-expanded="true"] .hp-qi-arrow { transform: rotate(180deg); color: #4F46E5; }

.hp-qi-a {
    padding: 0 16px 14px 16px;
    font-size: 0.81rem;
    color: #6b7280;
    line-height: 1.6;
}

/* ── Bottom tab bar ── */
.hp-tabbar {
    display: flex;
    border-top: 1px solid #f3f4f6;
    background: #fff;
    flex-shrink: 0;
}
.hp-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 4px 7px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.67rem;
    font-weight: 500;
    transition: color 0.12s;
}
.hp-tab svg { width: 20px; height: 20px; }
.hp-tab.is-active { color: #111827; }
.hp-tab:hover:not(.is-active) { color: #6b7280; }

/* ── Mobile ── */
@media (max-width: 480px) {
    #hp-panel {
        bottom: 0; right: 0; left: 0;
        width: 100%;
        height: min(620px, calc(100vh - 24px));
        border-radius: 20px 20px 0 0;
    }
    #hp-bubble { bottom: 16px; right: 16px; }
}
