/* Help Documentation Page Styles */

.help-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f8fafc;
    color: #1e293b;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.help-header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    font-size: 0.875rem;
    cursor: pointer;
    /* The prerendered pages use a real <a> here (no JS to intercept a click);
       the in-app page uses a <button>. One rule has to suit both. */
    text-decoration: none;
    transition: all 0.2s;
}

.back-button:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.help-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: #0f172a;
}

.help-header-right {
    display: flex;
    align-items: center;
}

.search-input {
    width: 280px;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #0f172a);     /* explicit high-contrast typed text */
    transition: all 0.2s;
}
.search-input::placeholder { color: var(--text-secondary, #94a3b8); }

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Content Layout */
.help-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.help-sidebar {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    padding: 1rem 0;
}

.shape-nav {
    padding: 0 0.5rem;
}

.nav-category {
    margin-bottom: 1.5rem;
}

.category-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.5rem 1rem;
    margin: 0;
}

.shape-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shape-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    margin: 0.125rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    /* It is an <a> now (so it can be opened in a new tab) — keep it looking like the
       list row it was, not like a blue underlined link. */
    color: inherit;
    text-decoration: none;
}

.shape-item:hover {
    background: #f1f5f9;
}

.shape-item.active {
    background: #eff6ff;
    color: #1d4ed8;
}

.shape-icon {
    font-size: 1.25rem;
}

.shape-name {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Main Content */
.help-main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
    background: #ffffff;
}

/* Documentation Content Styles */
.doc-container {
    max-width: 900px;
    margin: 0 auto;
}

.doc-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.doc-title {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.doc-description {
    font-size: 1.125rem;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

.doc-section {
    margin-bottom: 2.5rem;
}

.doc-section h2 {
    font-size: 1.375rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.doc-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #334155;
    margin: 1.5rem 0 0.75rem 0;
}

.doc-section p {
    color: #475569;
    line-height: 1.7;
    margin: 0 0 1rem 0;
}

.doc-section ul,
.doc-section ol {
    color: #475569;
    line-height: 1.7;
    padding-left: 1.5rem;
    margin: 0 0 1rem 0;
}

.doc-section li {
    margin-bottom: 0.5rem;
}

/* Code blocks */
.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.code-inline {
    background: #f1f5f9;
    color: #dc2626;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85em;
}

/* Feature cards */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.feature-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
}

.feature-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* API reference table */
.api-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.api-table th,
.api-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.api-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.api-table td {
    color: #334155;
}

.api-table tr:hover td {
    background: #f8fafc;
}

/* Keyboard shortcuts */
.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.shortcut-keys {
    display: flex;
    gap: 0.25rem;
}

.kbd {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: #475569;
    box-shadow: 0 1px 0 #d1d5db;
}

.shortcut-desc {
    color: #64748b;
    font-size: 0.875rem;
}

/* Tips/Notes */
.tip-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}

.tip-box.warning {
    background: #fef3c7;
    border-color: #fcd34d;
    border-left-color: #f59e0b;
}

.tip-box h5 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e40af;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tip-box.warning h5 {
    color: #92400e;
}

.tip-box p {
    font-size: 0.875rem;
    color: #1e40af;
    margin: 0;
}

.tip-box.warning p {
    color: #92400e;
}

/* Responsive */
@media (max-width: 768px) {
    .help-content {
        flex-direction: column;
    }

    .help-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        max-height: 200px;
    }

    .help-main {
        padding: 1.5rem;
    }

    .help-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .search-input {
        width: 100%;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading / failure states for a lazily-loaded doc page (see DocError in help-page.tsx) */
.doc-loading {
    padding: 2rem 0;
    color: var(--text-secondary, #64748b);
    font-size: 0.9375rem;
}

.doc-error {
    max-width: 640px;
    padding: 1.5rem 0;
}

.doc-error h2 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: var(--text-primary, #0f172a);
}

.doc-error p {
    margin: 0 0 1rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.6;
}

.doc-error-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.doc-error-actions button {
    padding: 0.45rem 1rem;
    font: inherit;
    font-size: 0.875rem;
    background: var(--bg-secondary, #f1f5f9);
    color: var(--text-primary, #1e293b);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    cursor: pointer;
}

.doc-error-actions button.doc-error-primary {
    font-weight: 600;
    color: #fff;
    background: #4c8dff;
    border-color: #4c8dff;
}

.doc-error pre {
    margin-top: 1rem;
    padding: 0.75rem;
    font-size: 0.6875rem;
    line-height: 1.5;
    color: var(--text-secondary, #94a3b8);
    background: var(--bg-secondary, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* Footer of the PRERENDERED pages (see prerender/page.ts). The in-app help page
   has the whole app around it and does not render one — these links exist so a
   static document is not a dead end for a reader or a crawler. */
.doc-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    justify-content: center;
    margin: 3rem auto 0;
    max-width: 900px;
    padding: 1.5rem 1rem 0;
    border-top: 1px solid #e2e8f0;
    font-size: 0.8125rem;
}

.doc-footer a {
    color: #64748b;
    text-decoration: none;
}

.doc-footer a:hover {
    color: #4c8dff;
    text-decoration: underline;
}
