/* Zab Notes — Help Topics (views/help.ejs). Uses the app's theme variables. */

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body.help {
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* ── Header with search ── */
.help-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}
.help-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}
.help-search {
    position: relative;
    flex: 1;
    max-width: 560px;
    display: flex;
    align-items: center;
}
.help-search-icon { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; }
.help-search input {
    width: 100%;
    padding: 9px 90px 9px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9rem;
    outline: none;
}
.help-search input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.help-count { position: absolute; right: 12px; font-size: 0.75rem; color: var(--text-muted); pointer-events: none; }
.help-btn {
    margin-left: auto;
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.help-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── Two columns: topic list + content ── */
.help-layout { flex: 1; min-height: 0; display: flex; }
.help-nav {
    width: 260px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 16px 12px 24px;
    border-right: 1px solid var(--border-color);
    background: var(--bg-sidebar, var(--bg-card));
    font-size: 0.85rem;
}
.help-nav-group { margin-bottom: 14px; }
.help-nav-group[hidden] { display: none; }
.help-nav-title {
    padding: 0 8px 4px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.help-nav a {
    display: block;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
}
.help-nav a:hover { background: var(--bg-hover); color: var(--text-primary); }
.help-nav a.is-current { background: var(--color-primary-light); color: var(--text-primary); }
.help-nav a[hidden] { display: none; }

.help-main { flex: 1; min-width: 0; overflow-y: auto; padding: 8px 40px 48px; scroll-behavior: smooth; }
.help-main > * { max-width: 820px; }

.help-empty { margin: 24px 0; color: var(--text-secondary); }
.help-empty[hidden] { display: none; }

.help-group[hidden], .help-topic[hidden] { display: none; }
.help-group-title {
    margin: 28px 0 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.help-topic {
    padding: 4px 0 18px;
    border-bottom: 1px solid var(--border-color-light, var(--border-color));
    scroll-margin-top: 12px;
}
.help-topic h3 { margin: 14px 0 8px; font-size: 1.15rem; line-height: 1.3; }
.help-topic.is-flash h3 { color: var(--color-primary); }
.help-topic p, .help-topic ul, .help-topic ol, .help-topic dl { margin: 0 0 10px; color: var(--text-secondary); }
.help-topic li { margin: 3px 0; }
.help-topic strong, .help-topic dt { color: var(--text-primary); }
.help-topic dt { font-weight: 600; margin-top: 10px; }
.help-topic dd { margin: 2px 0 0; }
.help-topic a, .help-empty a, .help-foot a { color: var(--color-primary); }

kbd {
    display: inline-block;
    padding: 0 5px;
    font-family: var(--font-mono, monospace);
    font-size: 0.78em;
    line-height: 1.6;
    border: 1px solid var(--border-color);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-primary);
}

mark.help-hit { background: color-mix(in srgb, var(--color-warning, #f59e0b) 45%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

.help-table-wrap { overflow-x: auto; margin: 0 0 10px; }
.help-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.help-table th, .help-table td { text-align: left; vertical-align: top; padding: 8px 10px; border: 1px solid var(--border-color); color: var(--text-secondary); }
.help-table th { color: var(--text-primary); background: var(--bg-hover); font-weight: 600; }
.help-keys td:nth-child(odd) { color: var(--text-primary); }
.help-keys td { white-space: nowrap; }

.help-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 32px;
    padding-top: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Narrow windows: topic list above the content ── */
@media (max-width: 760px) {
    .help-head { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
    .help-search { order: 3; flex-basis: 100%; max-width: none; }
    .help-layout { flex-direction: column; overflow-y: auto; }
    .help-nav { width: auto; max-height: 38vh; border-right: none; border-bottom: 1px solid var(--border-color); }
    .help-main { overflow: visible; padding: 8px 16px 40px; }
}

/* ── Print: the topics shown, nothing else ── */
@media print {
    .help-head, .help-nav, .help-foot { display: none !important; }
    body.help { display: block; background: #fff; color: #000; }
    .help-layout, .help-main { display: block; overflow: visible; padding: 0; }
    .help-topic { break-inside: avoid; }
    .help-topic p, .help-topic ul, .help-topic ol, .help-topic dl, .help-table td { color: #222; }
    mark.help-hit { background: none; }
}
