/* =============================================================================
   SEARCH HELP MODAL — Newtype v2 chrome

   Sits inside .modal-content (v2 HUD shell from components/modals.css), so the
   outer border, brackets and clip-path corners come from there. This file
   styles the inner structure: header strip, tab nav, help sections, code,
   tables, keyword grid, example pills, and the round HUD-square trigger
   button.
   ============================================================================= */

/* ── Inner sizing container ── */
.search-help-modal {
    max-width: 700px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* ── Header strip ── */
.search-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-xl);
    background: rgba(6, 8, 5, 0.4);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.search-help-header h3 {
    margin: 0;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* HUD-square close — matches .modal-close in modals.css. The
   `.search-help-close` class is paired with `.modal-close` on the same
   element so the shared rule covers most styling already; this keeps the
   shape consistent and slightly tightens spacing for the help-strip. */
.search-help-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 1;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.search-help-close:hover {
    border-color: var(--neon);
    color: var(--neon);
    background: var(--hover-bg);
    box-shadow: 0 0 8px var(--neon-glow);
    opacity: 1;
}

/* ── Body & content ── */
.search-help-body {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.search-help-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg) var(--spacing-xl);
}

/* ── Tab navigation ── */
.search-help-tabs {
    display: flex;
    gap: 0;
    padding: 0 var(--spacing-xl);
    background: transparent;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.search-help-tab {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 11px; /* HUD micro */
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
    white-space: nowrap;
    margin-bottom: -1px; /* sit on top of the .search-help-tabs bottom border */
}

.search-help-tab:hover {
    color: var(--text);
    background: var(--hover-bg);
}

.search-help-tab.active {
    color: var(--neon);
    border-bottom-color: var(--neon);
    background: transparent;
}

/* ── Tab content ── */
.search-help-tab-content {
    display: none;
}

.search-help-tab-content.active {
    display: block;
}

/* ── Help sections ── */
.help-section {
    margin-bottom: var(--spacing-xl);
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    margin: 0 0 var(--spacing-sm) 0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text);
    padding-left: var(--spacing-sm);
    border-left: 2px solid var(--neon);
}

.help-section p {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-2);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.help-section strong {
    color: var(--text);
    font-weight: var(--font-weight-semibold);
}

/* ── Code styling ── */
.help-section code,
.help-table code,
.help-example-pill code {
    background: rgba(46, 255, 126, 0.08);
    color: var(--neon);
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* ── Example blocks ── */
.help-example-block {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 0;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--text-2);
    font-family: var(--font-body);
}

.help-example-block:last-child {
    margin-bottom: 0;
}

.help-arrow {
    color: var(--text-3);
    font-family: var(--font-mono);
}

/* ── List styling ── */
.help-list {
    margin: 0;
    padding-left: var(--spacing-xl);
    color: var(--text-2);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.help-list li {
    margin-bottom: var(--spacing-xs);
}

.help-list li:last-child {
    margin-bottom: 0;
}

/* ── Logic blocks (OR/AND explanation) ── */
.help-logic-block {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.help-logic-item {
    display: grid;
    grid-template-columns: 50px 1fr;
    grid-template-rows: auto auto;
    gap: var(--spacing-xs) var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 0;
    align-items: center;
}

.help-logic-label {
    grid-row: span 2;
    font-family: var(--font-mono);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
    letter-spacing: 0.12em;
    color: var(--neon);
    text-align: center;
}

.help-logic-desc {
    color: var(--text-2);
    font-size: var(--font-size-sm);
}

.help-logic-item code {
    font-size: var(--font-size-sm);
}

.help-result {
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    font-style: normal;
    letter-spacing: 0.05em;
}

/* ── Tables ── */
.help-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-md);
}

.help-table th,
.help-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.help-table th {
    background: rgba(6, 8, 5, 0.4);
    color: var(--text-2);
    font-family: var(--font-mono);
    font-weight: var(--font-weight-bold);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.help-table td {
    color: var(--text-2);
}

.help-table tr:last-child td {
    border-bottom: none;
}

.help-table tr:hover td {
    background: var(--hover-bg);
}

.help-note {
    font-size: var(--font-size-xs);
    color: var(--text-3);
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    margin-top: var(--spacing-sm);
}

/* ── Keyword grid ── */
.help-keyword-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-sm);
}

.help-keyword-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 0;
}

.help-keyword-item code {
    font-size: var(--font-size-xs);
}

.help-keyword-item span {
    color: var(--text-3);
    font-size: var(--font-size-xs);
    font-family: var(--font-body);
}

/* ── Example pills (clickable HUD chips) ── */
.help-examples-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.help-example-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 0;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
    text-align: left;
}

.help-example-pill:hover {
    background: var(--hover-bg);
    border-color: var(--neon);
    box-shadow: 0 0 6px var(--neon-glow);
}

.help-example-pill .pill-label {
    font-family: var(--font-mono);
    font-weight: var(--font-weight-bold);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-2);
}

.help-example-pill code {
    font-size: var(--font-size-xs);
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text-3);
}

.help-example-pill:hover .pill-label {
    color: var(--neon);
}

.help-example-pill:hover code {
    color: var(--text);
}

/* ── HUD-square trigger button (in search bar) ── */
.search-help-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
    flex-shrink: 0;
}

.search-help-btn:hover {
    background: var(--hover-bg);
    border-color: var(--neon);
    color: var(--neon);
    box-shadow: 0 0 8px var(--neon-glow);
}

.search-help-btn:focus-visible {
    outline: 1px solid var(--neon);
    outline-offset: 2px;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .search-help-modal {
        max-height: 90vh;
        width: 100%;
        max-width: 100%;
    }

    .search-help-tabs {
        padding: 0 var(--spacing-md);
    }

    .search-help-tab {
        padding: var(--spacing-xs) var(--spacing-md);
        font-size: 10px;
    }

    .search-help-content {
        padding: var(--spacing-md);
    }

    .help-table {
        font-size: var(--font-size-xs);
    }

    .help-table th,
    .help-table td {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .help-keyword-grid {
        grid-template-columns: 1fr;
    }

    .help-logic-item {
        grid-template-columns: 40px 1fr;
    }

    .help-example-pill {
        width: 100%;
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .help-example-pill {
        transition: none;
    }
}
