/* ============================================================
   OppLogix Help Center — Stylesheet
   https://help.opplogix.com
   ============================================================ */

/* ----------------------------------------------------------
   1. Design Tokens
   ---------------------------------------------------------- */
:root {
    --brand: #7c5cff;
    --brand2: #19c6ff;
    --primary: #3b82f6;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #22c55e;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-width: 260px;
    --header-height: 64px;
}

/* ----------------------------------------------------------
   2. Reset & Base
   ---------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ----------------------------------------------------------
   3. Typography
   ---------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 0.75em;
}

h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; margin-top: 2.5rem; }
h3 { font-size: 1.25rem; font-weight: 600; margin-top: 2rem; }
h4 { font-size: 1.1rem; font-weight: 600; margin-top: 1.5rem; }

p {
    margin-bottom: 1rem;
}

ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.35rem;
}

strong {
    font-weight: 600;
}

code, kbd {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875em;
    background: var(--border-light);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15em 0.4em;
}

kbd {
    background: var(--text);
    color: var(--bg-white);
    border-color: var(--text);
    font-size: 0.8em;
    padding: 0.2em 0.5em;
}

pre {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ----------------------------------------------------------
   4. Header
   ---------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
    gap: 1rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex-shrink: 0;
}

.header-brand:hover {
    text-decoration: none;
}

.header-brand .logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    flex-shrink: 0;
}

.header-brand .logo-sm {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}

.brand-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
}

.header-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--brand);
    background: rgba(124, 92, 255, 0.08);
    border: 1px solid rgba(124, 92, 255, 0.2);
    border-radius: 20px;
    padding: 0.15em 0.65em;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Header search */
.header-search {
    flex: 1;
    max-width: 420px;
    position: relative;
}

.header-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1;
}

.header-search input {
    width: 100%;
    height: 40px;
    padding: 0 1rem 0 2.25rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.header-search input::placeholder {
    color: var(--text-light);
}

.header-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 360px;
    overflow-y: auto;
    z-index: 100;
}

.search-results.active {
    display: block;
}

.search-results a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    transition: background 0.1s ease;
}

.search-results a:last-child {
    border-bottom: none;
}

.search-results a:hover {
    background: var(--border-light);
    text-decoration: none;
}

.search-results mark {
    background: rgba(59, 130, 246, 0.15);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.btn-back-to-app {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.btn-back-to-app:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
    text-decoration: none;
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s ease;
}

.menu-toggle:hover {
    background: var(--border-light);
}

/* ----------------------------------------------------------
   5. Sidebar
   ---------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    z-index: 900;
    overflow: hidden;
}

.sidebar-inner {
    height: 100%;
    overflow-y: auto;
    padding: 1.25rem 0;
}

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-light);
    user-select: none;
}

.sidebar-heading i {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sidebar-link {
    display: block;
    padding: 0.4rem 1.25rem 0.4rem 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-left: 3px solid transparent;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.sidebar-link:hover {
    color: var(--text);
    background: var(--border-light);
    text-decoration: none;
}

.sidebar-link.active {
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
    background: rgba(59, 130, 246, 0.04);
}

/* ----------------------------------------------------------
   6. Main Content Area
   ---------------------------------------------------------- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem 4rem;
    min-height: calc(100vh - var(--header-height));
    display: flex;
    gap: 2rem;
}

.content-area {
    flex: 1;
    min-width: 0;
    max-width: 800px;
}

.content-body {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Full-width layout for index page (no sidebar) */
.main-content-full {
    margin-left: 0;
    padding: 2.5rem 3rem 4rem;
    min-height: calc(100vh - var(--header-height));
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--text-muted);
    transition: color 0.12s ease;
}

.breadcrumb a:hover {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb .sep {
    color: var(--text-light);
    margin: 0 0.1rem;
}

/* Page header */
.page-header {
    margin-bottom: 2.5rem;
}

.page-header h1 {
    margin-bottom: 0.5rem;
}

.page-description {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.6;
}

/* ----------------------------------------------------------
   7. Document Sections
   ---------------------------------------------------------- */
.doc-section {
    margin-bottom: 3rem;
}

.doc-section h2 {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.doc-section h2:target {
    scroll-margin-top: calc(var(--header-height) + 24px);
}

/* ----------------------------------------------------------
   8. Screenshots
   ---------------------------------------------------------- */
.screenshot-container {
    margin: 1.5rem 0;
}

.screenshot {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.screenshot:hover {
    transform: scale(1.015);
    box-shadow: var(--shadow-md);
}

/* Lightbox overlay */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: zoom-out;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.lightbox-overlay.active {
    opacity: 1;
}

.lightbox-overlay img {
    max-width: 95%;
    max-height: 90vh;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

/* ----------------------------------------------------------
   9. Steps Block
   ---------------------------------------------------------- */
.steps-block {
    margin: 1.5rem 0;
    padding-left: 0.25rem;
}

.step {
    display: flex;
    gap: 1rem;
    position: relative;
    padding-bottom: 1.25rem;
}

.step:last-child {
    padding-bottom: 0;
}

/* Vertical connecting line */
.step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 34px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: var(--primary);
    color: var(--bg-white);
    font-size: 0.8125rem;
    font-weight: 700;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

.step-content {
    padding-top: 0.3rem;
    line-height: 1.6;
}

/* ----------------------------------------------------------
   10. Callout Boxes
   ---------------------------------------------------------- */
.callout {
    display: flex;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    margin: 1.5rem 0;
}

.callout-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.callout-content {
    font-size: 0.9375rem;
    line-height: 1.65;
}

.callout-content p:last-child {
    margin-bottom: 0;
}

.callout-tip {
    border-left-color: var(--success);
    background: rgba(34, 197, 94, 0.05);
}

.callout-tip .callout-icon {
    color: var(--success);
}

.callout-warning {
    border-left-color: var(--warning);
    background: rgba(245, 158, 11, 0.05);
}

.callout-warning .callout-icon {
    color: var(--warning);
}

.callout-note {
    border-left-color: var(--primary);
    background: rgba(59, 130, 246, 0.04);
}

.callout-note .callout-icon {
    color: var(--primary);
}

/* ----------------------------------------------------------
   11. Documentation Tabs
   ---------------------------------------------------------- */
.tabs-doc {
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.tabs-doc-header {
    display: flex;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tab-doc-item {
    padding: 0.65rem 1.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: default;
    white-space: nowrap;
    transition: color 0.12s ease, border-color 0.12s ease;
}

.tab-doc-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-white);
}

.tabs-doc-body {
    padding: 1rem 1.25rem;
    background: var(--bg-white);
}

.tab-doc-desc {
    font-size: 0.9375rem;
    line-height: 1.65;
}

/* ----------------------------------------------------------
   12. FAQ Accordion
   ---------------------------------------------------------- */
.faq-section {
    margin: 2rem 0;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.625rem;
    overflow: hidden;
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-white);
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    line-height: 1.5;
    transition: background 0.12s ease;
}

.faq-question:hover {
    background: var(--border-light);
}

.faq-question::after {
    content: '\203A';
    font-size: 1.25rem;
    color: var(--text-light);
    transform: rotate(90deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.75rem;
}

.faq-item.open .faq-question::after {
    transform: rotate(270deg);
}

.faq-answer {
    display: none;
    padding: 0 1.25rem 1rem;
    font-size: 0.9375rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.faq-item.open .faq-answer {
    display: block;
}

/* ----------------------------------------------------------
   13. Related Articles
   ---------------------------------------------------------- */
.related-articles {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-articles h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.related-card {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.125rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.related-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
}

.related-card i {
    font-size: 1.5rem;
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.related-card strong {
    display: block;
    font-size: 0.9375rem;
    margin-bottom: 0.15rem;
}

.related-card p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}

/* ----------------------------------------------------------
   14. Table of Contents (Right Rail)
   ---------------------------------------------------------- */
.toc {
    display: none;
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    width: 180px;
    min-width: 180px;
    max-height: calc(100vh - var(--header-height) - 4rem);
    overflow-y: auto;
    flex-shrink: 0;
    align-self: flex-start;
}

.toc-header {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-light);
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
}

.toc-link {
    display: block;
    padding: 0.3rem 0 0.3rem 0.875rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    border-left: 2px solid var(--border);
    transition: color 0.12s ease, border-color 0.12s ease;
}

.toc-link:hover {
    color: var(--text);
    text-decoration: none;
}

.toc-link.active {
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

/* ----------------------------------------------------------
   15. Index / Hero Page
   ---------------------------------------------------------- */
.hero {
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    color: var(--bg-white);
    padding: 3rem 2.5rem;
    border-radius: var(--radius);
    margin-bottom: 2.5rem;
    text-align: center;
}

.hero h1 {
    color: var(--bg-white);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.05rem;
    opacity: 0.9;
    max-width: 540px;
    margin: 0 auto 1.5rem;
}

.hero-search {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
}

.hero-search .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 1;
}

.hero-search input {
    width: 100%;
    height: 48px;
    padding: 0 1.25rem 0 2.75rem;
    font-size: 1rem;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    outline: none;
    box-shadow: var(--shadow-md);
}

.hero-search input::placeholder {
    color: var(--text-light);
}

.hero-search input:focus {
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(255, 255, 255, 0.25);
}

/* Index page body */
.index-body {
    max-width: 100%;
}

.index-body h2 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.35rem;
}

/* Category cards grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.category-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: rgba(124, 92, 255, 0.25);
    text-decoration: none;
    color: var(--text);
}

.category-icon {
    margin-bottom: 0.75rem;
}

.category-icon i {
    font-size: 1.75rem;
    color: var(--brand);
}

.category-info h3 {
    font-size: 1rem;
    margin: 0 0 0.25rem;
    font-weight: 600;
}

.category-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Popular articles */
.popular-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.popular-card {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.popular-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
}

.popular-card i {
    font-size: 1.25rem;
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.popular-card strong {
    display: block;
    font-size: 0.9375rem;
    margin-bottom: 0.15rem;
}

.popular-card p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}

/* ----------------------------------------------------------
   16. Footer
   ---------------------------------------------------------- */
.site-footer {
    margin-left: var(--sidebar-width);
    border-top: 1px solid var(--border);
    background: var(--bg-white);
    padding: 2rem 2.5rem;
}

.index-page .site-footer {
    margin-left: 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1100px;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9375rem;
}

.footer-brand .logo,
.footer-brand .logo-sm {
    background: linear-gradient(135deg, var(--brand), var(--brand2));
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--primary);
    text-decoration: none;
}

.footer-copyright {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ----------------------------------------------------------
   17. Tables (content body)
   ---------------------------------------------------------- */
.content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9375rem;
}

.content-body th,
.content-body td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.content-body th {
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--border-light);
}

.content-body tr:last-child td {
    border-bottom: none;
}

/* ----------------------------------------------------------
   18. Utility Classes
   ---------------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.875rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ----------------------------------------------------------
   19. Large Screens (>= 1400px) — Show TOC
   ---------------------------------------------------------- */
@media (min-width: 1400px) {
    .toc {
        display: block;
    }

    /* When TOC is collapsed at top on smaller screens, hide it */
    .toc-mobile {
        display: none;
    }
}

/* ----------------------------------------------------------
   20. Tablet (768px - 1399px)
   ---------------------------------------------------------- */
@media (max-width: 1399px) {
    .toc {
        display: none;
    }

    /* TOC moves to top of content as collapsible block */
    .toc-mobile {
        display: block;
        margin-bottom: 2rem;
        background: var(--bg-white);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 1rem 1.25rem;
    }

    .toc-mobile .toc-header {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 0;
        margin-bottom: 0;
    }

    .toc-mobile .toc-header::after {
        content: '\203A';
        font-size: 1.1rem;
        color: var(--text-light);
        transform: rotate(90deg);
        transition: transform 0.2s ease;
    }

    .toc-mobile.open .toc-header::after {
        transform: rotate(270deg);
    }

    .toc-mobile .toc-links {
        display: none;
        padding-top: 0.75rem;
    }

    .toc-mobile.open .toc-links {
        display: block;
    }

    .toc-mobile .toc-link {
        padding: 0.3rem 0 0.3rem 0.875rem;
        font-size: 0.8125rem;
        color: var(--text-muted);
        border-left: 2px solid var(--border);
        display: block;
    }

    .toc-mobile .toc-link.active {
        color: var(--primary);
        border-left-color: var(--primary);
    }

    .main-content {
        padding: 1.5rem 2rem 3rem;
    }
}

/* Index page responsive — category grid to single column on narrow */
@media (max-width: 600px) {
    .category-grid {
        grid-template-columns: 1fr;
    }

    .main-content-full {
        padding: 1.25rem 1rem 3rem;
    }
}

/* ----------------------------------------------------------
   21. Mobile (< 768px)
   ---------------------------------------------------------- */
@media (max-width: 767px) {
    :root {
        --header-height: 56px;
    }

    .header-search {
        display: none;
    }

    .brand-text {
        font-size: 1rem;
    }

    .btn-back-to-app {
        display: none;
    }

    .menu-toggle {
        display: flex;
    }

    /* Sidebar becomes overlay */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
        z-index: 1100;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1050;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Main content full-width */
    .main-content {
        margin-left: 0;
        padding: 1.25rem 1rem 3rem;
    }

    .site-footer {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    /* Hero adjustments */
    .hero {
        padding: 2rem 1.5rem;
        border-radius: var(--radius-sm);
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .main-content-full {
        padding: 1.25rem 1rem 3rem;
    }

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

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

    /* Page header */
    h1 {
        font-size: 1.625rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Steps block */
    .step-number {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 0.75rem;
    }

    .step:not(:last-child)::after {
        left: 13px;
        top: 30px;
    }

    /* Callout */
    .callout {
        padding: 0.875rem 1rem;
    }

    /* Tabs */
    .tab-doc-item {
        padding: 0.5rem 0.85rem;
        font-size: 0.75rem;
    }
}

/* ----------------------------------------------------------
   22. Print Styles
   ---------------------------------------------------------- */
@media print {
    .site-header,
    .sidebar,
    .toc,
    .toc-mobile,
    .site-footer,
    .menu-toggle,
    .header-actions,
    .search-results,
    .related-articles,
    .faq-section .faq-question::after {
        display: none !important;
    }

    body {
        background: white;
        color: black;
        font-size: 11pt;
        line-height: 1.5;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    .content-area,
    .content-body {
        max-width: 100%;
    }

    .hero {
        background: none !important;
        color: black;
        padding: 1rem 0;
    }

    .hero h1 {
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .callout {
        border: 1px solid #ccc;
        background: none !important;
    }

    .screenshot {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .faq-answer {
        display: block !important;
    }

    .doc-section {
        page-break-inside: avoid;
    }
}

/* ----------------------------------------------------------
   23. Scrollbar Styling (Webkit)
   ---------------------------------------------------------- */
.sidebar-inner::-webkit-scrollbar,
.toc::-webkit-scrollbar {
    width: 4px;
}

.sidebar-inner::-webkit-scrollbar-track,
.toc::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-inner::-webkit-scrollbar-thumb,
.toc::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar-inner::-webkit-scrollbar-thumb:hover,
.toc::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ----------------------------------------------------------
   24. Transitions & Animations
   ---------------------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-body {
    animation: fadeIn 0.3s ease;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Selection color */
::selection {
    background: rgba(124, 92, 255, 0.15);
    color: var(--text);
}
