<?php


$tphCtx = [
    'menu' => $activeMenu ?? '',
    'tab'  => $_GET['tab'] ?? '',
    'sub'  => $_GET['sub'] ?? '',
];
?>
<style>
#tphelp, #tphelp * { box-sizing: border-box; }
#tphelp { font: 14px/1.55 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif; }

 
#tphelp-bubble {
    position: fixed; right: 22px; bottom: 22px; z-index: 99979;
    display: none; align-items: center; gap: 8px;
    padding: 11px 16px 11px 13px; border: 1px solid #e2e8f0; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
    background: #fff; color: #1e293b; border-radius: 999px;
    font: 600 14px/1 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
    box-shadow: 0 8px 22px -6px rgba(15,23,42,.22), 0 2px 6px rgba(15,23,42,.08);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    white-space: nowrap;
}
#tphelp-bubble:hover { transform: translateY(-2px); border-color: #cdd7e5; box-shadow: 0 12px 26px -6px rgba(15,23,42,.26); }
#tphelp-bubble.tphelp-dragging, #tphelp-bubble.tphelp-dragging:hover { cursor: grabbing; transition: none !important; transform: none !important; box-shadow: 0 16px 34px -8px rgba(15,23,42,.34) !important; border-color: #b9c4d4 !important; }
#tphelp-bubble i { font-size: 16px; color: #2563eb; }
#tphelp.open #tphelp-bubble { opacity: 0; pointer-events: none; }
 
#tpsup-bubble { display: none !important; }

 
#tphelp-backdrop {
    position: fixed; inset: 0; z-index: 99984; background: rgba(15,23,42,.34);
    opacity: 0; pointer-events: none; transition: opacity .25s ease;
    backdrop-filter: blur(1px);
}
#tphelp.open #tphelp-backdrop { opacity: 1; pointer-events: auto; }

 
#tphelp-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 99985;
    width: 432px; max-width: 100vw; background: #f6f8fb;
    display: flex; flex-direction: column; overflow-x: hidden;
    box-shadow: -24px 0 60px -20px rgba(15,23,42,.4);
    transform: translateX(101%); transition: transform .28s cubic-bezier(.4,0,.2,1);
    color: #0f172a;
}
#tphelp:not(.open) #tphelp-drawer { visibility: hidden; }
#tphelp.open #tphelp-drawer { visibility: visible; }
#tphelp.open #tphelp-drawer { transform: translateX(0); }

 
.tph-head { background: linear-gradient(135deg,#2563eb,#1d4ed8); color: #fff; padding: 15px 16px 14px; flex-shrink: 0; }
.tph-head-row { display: flex; align-items: center; gap: 10px; }
.tph-head-ico { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.tph-head h3 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.15; }
.tph-head p { margin: 1px 0 0; font-size: 12px; opacity: .82; }
.tph-head .tph-htxt { flex: 1; min-width: 0; }
.tph-head .tph-htxt h3, .tph-head .tph-htxt p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tph-iconbtn { background: rgba(255,255,255,.15); border: none; color: #fff; width: 32px; height: 32px; border-radius: 9px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; font-size: 14px; }
.tph-iconbtn:hover { background: rgba(255,255,255,.3); }
.tph-back { display: none; }
#tphelp.has-back .tph-back { display: flex; }

 
.tph-search { position: relative; margin-top: 13px; }
.tph-search input { width: 100%; border: none; border-radius: 11px; padding: 11px 38px 11px 38px; font: inherit; font-size: 14px; background: rgba(255,255,255,.97); color: #0f172a; box-shadow: 0 2px 8px rgba(15,23,42,.12); }
.tph-search input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,.5); }
.tph-search .tph-sico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 14px; pointer-events: none; }
.tph-search .tph-clear { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); border: none; background: #e2e8f0; color: #64748b; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; display: none; align-items: center; justify-content: center; font-size: 11px; }
.tph-search .tph-clear:hover { background: #cbd5e1; }
.tph-search.has-val .tph-clear { display: flex; }

 
.tph-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px; -webkit-overflow-scrolling: touch; }
.tph-body::-webkit-scrollbar { width: 9px; }
.tph-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9px; border: 2px solid #f6f8fb; }

 
.tph-foot { flex-shrink: 0; border-top: 1px solid #e7ecf3; background: #fff; padding: 11px 14px; display: flex; align-items: center; gap: 10px; }
.tph-foot-txt { flex: 1; min-width: 0; font-size: 12.5px; color: #64748b; }
.tph-foot-txt strong { color: #1e293b; font-weight: 600; display: block; font-size: 13px; }
.tph-foot button { flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px; border: none; background: #2563eb; color: #fff; font: inherit; font-size: 13px; font-weight: 600; padding: 9px 13px; border-radius: 9px; cursor: pointer; transition: background .15s; white-space: nowrap; }
.tph-foot button:hover { background: #1d4ed8; }

 
.tph-sec-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; margin: 4px 2px 9px; }
.tph-sec-title:not(:first-child) { margin-top: 20px; }

.tph-ctx { background: linear-gradient(135deg,#eff6ff,#f5f3ff); border: 1px solid #dbe6fb; border-radius: 14px; padding: 12px 13px; margin-bottom: 4px; }
.tph-ctx-h { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: #1d4ed8; margin-bottom: 9px; }
.tph-ctx-h i { font-size: 12px; }
.tph-ctx a { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 9px; text-decoration: none; color: #1e293b; font-size: 13.5px; font-weight: 500; transition: background .12s; }
.tph-ctx a:hover { background: rgba(255,255,255,.75); }
.tph-ctx a i.lead { color: #2563eb; font-size: 13px; width: 16px; text-align: center; flex-shrink: 0; }
.tph-ctx a .go { margin-left: auto; color: #94a3b8; font-size: 11px; }

.tph-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tph-quick a { display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid #e7ecf3; border-radius: 11px; padding: 11px 11px; text-decoration: none; color: #1e293b; font-size: 13px; font-weight: 600; transition: border-color .12s, box-shadow .12s, transform .12s; min-width: 0; }
.tph-quick a:hover { border-color: #bfd3f3; box-shadow: 0 6px 16px -8px rgba(37,99,235,.3); transform: translateY(-1px); }
.tph-quick a span.qtxt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tph-quick a .qi { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }

.tph-cats { display: flex; flex-direction: column; gap: 8px; }
.tph-cat { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid #e7ecf3; border-radius: 13px; padding: 13px 14px; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; text-align: left; width: 100%; font: inherit; }
.tph-cat:hover { border-color: #cdd7e5; box-shadow: 0 8px 20px -10px rgba(15,23,42,.2); transform: translateY(-1px); }
.tph-cat .ci { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.tph-cat .ct { flex: 1; min-width: 0; }
.tph-cat .ct h4 { margin: 0; font-size: 14.5px; font-weight: 600; color: #0f172a; }
.tph-cat .ct p { margin: 2px 0 0; font-size: 12.5px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tph-cat .cc { margin-left: auto; flex-shrink: 0; color: #cbd5e1; font-size: 13px; }

 
.tph-cathead { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.tph-cathead .ci { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.tph-cathead h2 { margin: 0; font-size: 18px; font-weight: 700; }
.tph-cathead p { margin: 2px 0 0; font-size: 13px; color: #64748b; }
.tph-group { margin-bottom: 18px; }
.tph-group-t { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; margin: 0 2px 8px; }
.tph-arts { display: flex; flex-direction: column; gap: 7px; }
.tph-art { display: flex; align-items: center; gap: 11px; background: #fff; border: 1px solid #e7ecf3; border-radius: 11px; padding: 12px 13px; cursor: pointer; transition: border-color .12s, box-shadow .12s; text-align: left; width: 100%; font: inherit; }
.tph-art:hover { border-color: #bfd3f3; box-shadow: 0 5px 15px -8px rgba(37,99,235,.28); }
.tph-art i.lead { color: #2563eb; font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.tph-art span { flex: 1; min-width: 0; font-size: 13.8px; font-weight: 500; color: #1e293b; }
.tph-art i.go { color: #cbd5e1; font-size: 12px; }

 
.tph-article h1 { font-size: 19px; font-weight: 700; margin: 0 0 4px; line-height: 1.25; }
.tph-crumb { font-size: 12px; color: #94a3b8; font-weight: 600; margin-bottom: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: none; border: none; padding: 0; }
.tph-crumb:hover { color: #2563eb; }
.tph-prose { font-size: 13.8px; color: #334155; line-height: 1.62; }
.tph-prose p { margin: 0 0 11px; }
.tph-prose strong { color: #0f172a; font-weight: 650; }
.tph-prose code { background: #eef2f7; border: 1px solid #e2e8f0; border-radius: 5px; padding: 1px 5px; font-size: 12.3px; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: #1e293b; word-break: break-word; }
.tph-prose h4.tph-sub { font-size: 13px; font-weight: 700; color: #0f172a; margin: 16px 0 7px; }
.tph-prose ul { margin: 0 0 12px; padding-left: 2px; list-style: none; }
.tph-prose ul li { position: relative; padding-left: 19px; margin-bottom: 6px; }
.tph-prose ul li::before { content: ""; position: absolute; left: 4px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: #93c5fd; }
.tph-steps { counter-reset: s; margin: 0 0 13px; padding: 0; list-style: none; }
.tph-steps li { counter-increment: s; position: relative; padding-left: 31px; margin-bottom: 9px; }
.tph-steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 21px; height: 21px; border-radius: 50%; background: #2563eb; color: #fff; font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tph-cal { border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.55; margin: 0 0 13px; display: flex; gap: 9px; }
.tph-cal i { margin-top: 2px; flex-shrink: 0; }
.tph-cal-tip { background: #eff6ff; border: 1px solid #cfe0fb; color: #1e40af; }
.tph-cal-tip i { color: #2563eb; }
.tph-cal-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.tph-cal-warn i { color: #d97706; }
.tph-cal-danger { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.tph-cal-danger i { color: #dc2626; }

.tph-links { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 4px; }
.tph-link { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #d6e2f7; border-radius: 11px; padding: 11px 13px; text-decoration: none; color: #1d4ed8; font-size: 13.5px; font-weight: 650; transition: background .12s, border-color .12s, box-shadow .12s; }
.tph-link:hover { background: #eff6ff; border-color: #bfd3f3; box-shadow: 0 6px 16px -9px rgba(37,99,235,.4); }
.tph-link > i:first-child { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.tph-link span { flex: 1; min-width: 0; }
.tph-link .tph-link-go { color: #93b4ed; font-size: 12px; }

.tph-related { margin-top: 22px; border-top: 1px solid #e7ecf3; padding-top: 14px; }

 
.tph-results { display: flex; flex-direction: column; gap: 8px; }
.tph-result { display: flex; align-items: flex-start; gap: 11px; background: #fff; border: 1px solid #e7ecf3; border-radius: 11px; padding: 12px 13px; cursor: pointer; transition: border-color .12s, box-shadow .12s; text-align: left; width: 100%; font: inherit; }
.tph-result:hover { border-color: #bfd3f3; box-shadow: 0 5px 15px -8px rgba(37,99,235,.28); }
.tph-result .ri { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; margin-top: 1px; }
.tph-result .rt { flex: 1; min-width: 0; }
.tph-result .rt h4 { margin: 0; font-size: 13.8px; font-weight: 600; color: #0f172a; }
.tph-result .rt p { margin: 2px 0 0; font-size: 12px; color: #94a3b8; line-height: 1.45; }
.tph-empty { text-align: center; padding: 46px 24px; color: #94a3b8; }
.tph-empty i { font-size: 32px; color: #cbd5e1; margin-bottom: 13px; }
.tph-empty p { margin: 0; font-size: 13.5px; }
.tph-empty .sub { font-size: 12.5px; margin-top: 4px; color: #b6c2d2; }

@media (max-width: 560px) {
    

    #tphelp-drawer { left: 0 !important; right: 0 !important; width: auto !important; max-width: 100% !important; }
    .tph-quick { grid-template-columns: 1fr; }
    .tph-body { padding: 15px 14px 22px; }
    .tph-head { padding-left: 14px; padding-right: 14px; }
    .tph-foot { padding-left: 12px; padding-right: 12px; }
    .tph-foot button span.lbl { display: none; }
    .tph-foot button { padding: 10px 12px; }
    #tphelp-bubble { right: 16px; bottom: 16px; }
}
</style>

<div id="tphelp">
    <button id="tphelp-bubble" type="button" aria-label="Open help center">
        <i class="fa-solid fa-circle-question"></i><span>Help</span>
    </button>
    <div id="tphelp-backdrop"></div>
    <aside id="tphelp-drawer" role="dialog" aria-label="Help Center" aria-modal="true">
        <div class="tph-head">
            <div class="tph-head-row">
                <button class="tph-iconbtn tph-back" id="tphelp-back" type="button" aria-label="Back"><i class="fa-solid fa-arrow-left"></i></button>
                <div class="tph-head-ico" id="tphelp-head-ico"><i class="fa-solid fa-life-ring"></i></div>
                <div class="tph-htxt">
                    <h3 id="tphelp-title">Help Center</h3>
                    <p id="tphelp-sub">Search guides &amp; find any setting</p>
                </div>
                <button class="tph-iconbtn" id="tphelp-close" type="button" aria-label="Close"><i class="fa-solid fa-xmark"></i></button>
            </div>
            <div class="tph-search" id="tphelp-searchwrap">
                <i class="fa-solid fa-magnifying-glass tph-sico"></i>
                <input type="text" id="tphelp-input" placeholder="Search help… (e.g. transcoding, logo, email)" autocomplete="off" spellcheck="false">
                <button class="tph-clear" id="tphelp-clear" type="button" aria-label="Clear"><i class="fa-solid fa-xmark"></i></button>
            </div>
        </div>
        <div class="tph-body" id="tphelp-body"></div>
        <div class="tph-foot">
            <div class="tph-foot-txt"><strong>Still stuck?</strong>Reach a human on the support desk.</div>
            <button id="tphelp-contact" type="button"><i class="fa-solid fa-headset"></i> <span class="lbl">Contact support</span></button>
        </div>
    </aside>
</div>

<script type="application/json" id="tp-help-boot"><?= json_encode($tphCtx, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) ?></script>
<script src="<?= AdminAssets::url('help-widget.js') ?>" defer></script>


