/**
 * Shared Help System — contextual ? buttons and popover
 * Include this CSS + the JS block at bottom of each page.
 */

/* Help trigger button */
.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #718096;
    color: white;
    border: none;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    vertical-align: middle;
    transition: background .15s;
}
.help-btn:hover { background: #4a5568; }

/* Help popover */
.help-popover {
    position: fixed;
    z-index: 9999;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    padding: 0;
    width: 520px;
    max-width: calc(100vw - 24px);
    min-width: 280px;
    display: none;
    animation: helpFadeIn .15s ease;
    /* Prevent the whole popover from overflowing viewport height */
    max-height: calc(100vh - 80px);
    display: none;
    flex-direction: column;
}
.help-popover.visible { display: flex; }
@keyframes helpFadeIn {
    from { opacity:0; transform: translateY(-4px); }
    to   { opacity:1; transform: translateY(0); }
}
.help-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.help-popover-header h3 {
    margin: 0;
    font-size: 14px;
    color: #2d3748;
}
.help-popover-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #718096;
    padding: 0 2px;
    line-height: 1;
}
.help-popover-close:hover { color: #2d3748; }
.help-popover-body {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.6;
    padding: 14px 18px 16px;
    overflow-y: auto;
    /* max-height keeps scroll contained; header ~60px, safety 20px */
    max-height: calc(100vh - 80px - 60px - 20px);
}
.help-popover-body ul {
    margin: 8px 0 0;
    padding-left: 18px;
}
.help-popover-body li { margin-bottom: 4px; }
.help-popover-body code {
    background: #edf2f7;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}
/* Backdrop: clicking outside closes */
.help-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
}
.help-backdrop.visible { display: block; }
