/* ═══════════════════════════════════════════════════
   Profill 3PL — Documentation Stylesheet
   Matches the clean official-docs design in screenshot
═══════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────── */
:root {
    --color-bg:           #f5f6f8;
    --color-surface:      #ffffff;
    --color-border:       #e5e7eb;
    --color-border-light: #f0f1f3;

    --color-text:         #111827;
    --color-text-secondary: #374151;
    --color-text-muted:   #6b7280;
    --color-text-light:   #9ca3af;

    --color-primary:      #6c63ff;   /* purple accent — matches screenshot active state */
    --color-primary-bg:   #ede9fe;
    --color-primary-hover:#5b52d6;

    --color-green:        #059669;
    --color-green-bg:     #d1fae5;
    --color-orange:       #d97706;
    --color-orange-bg:    #fef3c7;
    --color-red:          #dc2626;
    --color-red-bg:       #fee2e2;
    --color-blue:         #2563eb;
    --color-blue-bg:      #dbeafe;

    --sidebar-left-width:  240px;
    --sidebar-right-width: 220px;
    --header-height:       56px;

    --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:   'JetBrains Mono', 'Fira Code', monospace;

    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;

    --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,.08);
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.65;
    color: var(--color-text);
    background: var(--color-bg);
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ══════════════════════════════════════════════════
   TOP HEADER
══════════════════════════════════════════════════ */
.top-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    z-index: 200;
}

.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 24px;
    gap: 20px;
}

/* Logo */
.header-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.logo-mark {
    width: 30px; height: 30px;
    background: var(--color-primary);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700; color: #fff;
}
.logo-title {
    display: block;
    font-size: 14px; font-weight: 700; color: var(--color-text);
    line-height: 1.2;
}
.logo-sub {
    display: block;
    font-size: 11px; color: var(--color-text-muted); font-weight: 400;
}

/* Search */
.header-search-wrap {
    position: relative;
    flex: 1;
    max-width: 380px;
    margin: 0 12px;
}
.search-icon {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-light);
    pointer-events: none;
}
.header-search {
    width: 100%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 7px 40px 7px 32px;
    font-size: 13px; font-family: var(--font-sans);
    color: var(--color-text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.header-search:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(108,99,255,.12);
}
.search-kbd {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    font-size: 11px; color: var(--color-text-light);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px; padding: 1px 5px;
}

/* Right items */
.header-right {
    margin-left: auto;
    display: flex; align-items: center; gap: 14px;
}
.version-badge {
    font-size: 11px; font-weight: 600;
    background: var(--color-primary-bg);
    color: var(--color-primary);
    padding: 2px 9px; border-radius: 20px;
}
.header-link {
    font-size: 13px; font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color .15s;
}
.header-link:hover { color: var(--color-text); }
.mobile-menu-btn {
    display: none;
    background: none; border: none; cursor: pointer;
    color: var(--color-text-muted); padding: 4px;
}

/* ══════════════════════════════════════════════════
   THREE-COLUMN LAYOUT
══════════════════════════════════════════════════ */
.docs-layout {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ── LEFT SIDEBAR ──────────────────────────────── */
.sidebar-left {
    width: var(--sidebar-left-width);
    flex-shrink: 0;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
}

.sidebar-left::-webkit-scrollbar { width: 4px; }
.sidebar-left::-webkit-scrollbar-track { background: transparent; }
.sidebar-left::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

.sidebar-inner { padding: 20px 0 32px; }

.sidebar-title {
    font-size: 12px; font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: 0 18px 14px;
}

/* Nav sections */
.nav-section { margin-bottom: 2px; }

.nav-section-toggle {
    width: 100%;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 18px;
    background: none; border: none;
    font-family: var(--font-sans);
    font-size: 13.5px; font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    text-align: left;
    transition: color .15s;
}
.nav-section-toggle:hover { color: var(--color-text); }

.section-icon { color: var(--color-text-muted); flex-shrink: 0; }

.section-label { flex: 1; }

.chevron {
    color: var(--color-text-light);
    transition: transform .2s ease;
    flex-shrink: 0;
}
.nav-section-toggle.open .chevron { transform: rotate(180deg); }

/* Nav items */
.nav-items {
    list-style: none;
    padding: 2px 0 6px;
    overflow: hidden;
}

.nav-link {
    display: block;
    padding: 6px 18px 6px 42px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: 0;
    transition: color .12s, background .12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid transparent;
    margin-left: 0;
}
.nav-link:hover {
    color: var(--color-text);
    background: var(--color-bg);
    text-decoration: none;
}
.nav-link.active {
    color: var(--color-primary);
    background: var(--color-primary-bg);
    border-left-color: var(--color-primary);
    font-weight: 500;
}

/* ── MAIN CONTENT ──────────────────────────────── */
.docs-main {
    flex: 1;
    min-width: 0;
    background: var(--color-surface);
}

.docs-content {
    max-width: 820px;
    padding: 36px 48px 64px;
    margin: 0 auto;
}

/* ── RIGHT TOC SIDEBAR ─────────────────────────── */
.sidebar-right {
    width: var(--sidebar-right-width);
    flex-shrink: 0;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    border-left: 1px solid var(--color-border);
    background: var(--color-surface);
}

.sidebar-right::-webkit-scrollbar { width: 4px; }
.sidebar-right::-webkit-scrollbar-track { background: transparent; }
.sidebar-right::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

.toc-wrap { padding: 24px 20px 32px; }

.toc-heading {
    font-size: 11.5px; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.toc-nav { display: flex; flex-direction: column; gap: 0; }

.toc-link {
    display: block;
    font-size: 13px;
    color: var(--color-text-muted);
    padding: 4px 0 4px 12px;
    border-left: 2px solid transparent;
    text-decoration: none;
    transition: color .12s, border-color .12s;
    line-height: 1.5;
}
.toc-link:hover { color: var(--color-text); border-left-color: var(--color-border); text-decoration: none; }
.toc-link.toc-active {
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 500;
}

.toc-link.toc-sub { padding-left: 24px; font-size: 12.5px; }

/* Back to top button */
.back-to-top {
    display: flex; align-items: center; gap: 5px;
    margin-top: 20px;
    padding: 6px 12px;
    background: var(--color-text);
    color: #fff;
    border: none; border-radius: var(--radius-md);
    font-size: 12px; font-weight: 500; font-family: var(--font-sans);
    cursor: pointer;
    transition: background .15s;
}
.back-to-top:hover { background: var(--color-primary); }

/* ══════════════════════════════════════════════════
   SECTION ELEMENTS
══════════════════════════════════════════════════ */

.doc-section { margin-bottom: 8px; }

.section-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 36px 0;
}

.section-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px;
}

.section-title {
    font-size: 20px; font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
}

.section-lead {
    font-size: 14.5px;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
    line-height: 1.7;
}

/* Feature badges */
.feature-badge {
    display: inline-flex; align-items: center;
    font-size: 11.5px; font-weight: 600;
    padding: 3px 10px; border-radius: 20px;
}
.feature-badge--core { background: #dbeafe; color: #1d4ed8; }
.feature-badge--new  { background: var(--color-green-bg); color: var(--color-green); }
.feature-badge--beta { background: var(--color-orange-bg); color: var(--color-orange); }

/* ── Menu Cards ─────────────────────────────────── */
.menu-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.menu-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px 16px 16px;
    text-decoration: none;
    display: flex; flex-direction: column;
    transition: box-shadow .15s, border-color .15s, transform .1s;
}
.menu-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #d0d5dd;
    transform: translateY(-1px);
    text-decoration: none;
}

.menu-card-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}

.menu-card-title {
    font-size: 13.5px; font-weight: 700;
    color: var(--color-text);
    margin-bottom: 5px;
}

.menu-card-desc {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ── Content Block ──────────────────────────────── */
.content-block {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin: 18px 0;
}

.block-title {
    font-size: 14px; font-weight: 700;
    color: var(--color-text);
    margin-bottom: 14px;
}

/* ── Simulated UI Frame ─────────────────────────── */
.ui-frame {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.ui-frame-bar {
    background: #f9fafb;
    border-bottom: 1px solid var(--color-border);
    padding: 8px 12px;
    display: flex; align-items: center; gap: 6px;
}

.ui-dot { width: 10px; height: 10px; border-radius: 50%; }

.ui-frame-url {
    font-size: 11.5px; color: var(--color-text-muted);
    margin-left: 8px; font-family: var(--font-mono);
}

.ui-frame-body { padding: 0; }

/* Simulated toolbar inside frame */
.sim-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-light);
    background: #fff;
    flex-wrap: wrap; gap: 8px;
}

.sim-toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sim-toolbar-right { display: flex; align-items: center; gap: 8px; }

.sim-page-title { font-size: 13px; font-weight: 700; color: var(--color-text); }

.sim-env-badge {
    font-size: 11px; font-weight: 600;
    background: #fef3c7; color: #d97706;
    padding: 2px 8px; border-radius: 20px;
}

.sim-env-note { font-size: 11px; color: var(--color-text-muted); }

.sim-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px;
    font-size: 12px; font-weight: 500; font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}
.sim-btn--outline { background: #fff; border: 1px solid var(--color-border); color: var(--color-text-secondary); }
.sim-btn--outline:hover { background: var(--color-bg); border-color: #c0c4cc; }
.sim-btn--primary { background: var(--color-text); border: 1px solid var(--color-text); color: #fff; }
.sim-btn--primary:hover { background: #374151; }
.sim-btn--sm { padding: 3px 9px; font-size: 11.5px; }

.sim-sync-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: #f8faff;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 12px; color: var(--color-text-muted);
}

.sim-filter-row {
    display: flex; gap: 0;
    padding: 8px 14px;
    border-bottom: 1px solid var(--color-border-light);
}

.sim-filter {
    padding: 4px 14px;
    font-size: 12.5px; font-weight: 500;
    background: none; border: 1px solid var(--color-border);
    color: var(--color-text-muted); cursor: pointer;
    transition: all .12s;
}
.sim-filter:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.sim-filter:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.sim-filter + .sim-filter { border-left: none; }
.sim-filter.active { background: var(--color-text); border-color: var(--color-text); color: #fff; }

.sim-table-head {
    display: grid;
    grid-template-columns: 80px 60px 1fr 70px 70px 90px 90px 70px 100px 70px;
    gap: 0;
    padding: 8px 14px;
    background: #f9fafb;
    border-top: 1px solid var(--color-border-light);
    font-size: 11px; font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase; letter-spacing: .04em;
    overflow-x: auto;
}

/* ── Action list ────────────────────────────────── */
.action-list { margin-top: 4px; }

.action-item {
    font-size: 13.5px;
    margin-bottom: 6px;
}

.action-label {
    font-weight: 600; color: var(--color-text);
    margin-right: 4px;
}

.action-desc { color: var(--color-text-secondary); }

.action-bullets {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
}

.action-bullets li {
    font-size: 13.5px;
    color: var(--color-text-secondary);
    padding: 3px 0 3px 18px;
    position: relative;
}
.action-bullets li::before {
    content: '•';
    position: absolute; left: 6px;
    color: var(--color-text-light);
}

/* ── Callouts ───────────────────────────────────── */
.callout {
    display: flex; gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border-left: 3px solid;
    margin: 16px 0;
    font-size: 13.5px; line-height: 1.6;
}

.callout-icon { flex-shrink: 0; margin-top: 2px; }

.callout--info { background: #eff6ff; border-color: #3b82f6; color: #1e3a5f; }
.callout--warning { background: #fffbeb; border-color: #f59e0b; color: #5a3e00; }
.callout--success { background: #f0fdf4; border-color: #22c55e; color: #14532d; }
.callout--danger { background: #fef2f2; border-color: #ef4444; color: #7f1d1d; }

/* ── Step list ──────────────────────────────────── */
.step-list { list-style: none; margin: 16px 0; }

.step-item {
    display: flex; gap: 14px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.step-num {
    width: 26px; height: 26px; flex-shrink: 0;
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    margin-top: 1px;
}

.step-body { flex: 1; padding-top: 3px; font-size: 13.5px; }
.step-body p { color: var(--color-text-secondary); }
.step-body strong { color: var(--color-text); }

/* ── Video embed ────────────────────────────────── */
.video-embed {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: var(--radius-lg);
    margin: 20px 0;
    overflow: hidden;
    cursor: pointer;
    transition: opacity .15s;
    position: relative;
}
.video-embed:hover { opacity: .95; }

.video-thumbnail {
    display: flex; align-items: center;
    padding: 28px 24px;
    gap: 20px;
}

.video-play-btn {
    width: 54px; height: 54px; flex-shrink: 0;
    background: rgba(255,255,255,.15);
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, transform .15s;
}
.video-embed:hover .video-play-btn { background: rgba(255,255,255,.25); transform: scale(1.05); }

.video-info {}
.video-title { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 5px; }
.video-meta { font-size: 12px; color: rgba(255,255,255,.55); }

/* ── Tables ─────────────────────────────────────── */
.docs-table {
    width: 100%; border-collapse: collapse;
    margin: 16px 0; font-size: 13.5px;
}

.docs-table thead { background: #f9fafb; }

.docs-table th {
    text-align: left;
    padding: 9px 14px;
    font-size: 12px; font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase; letter-spacing: .04em;
    border: 1px solid var(--color-border);
}

.docs-table td {
    padding: 9px 14px;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    vertical-align: top;
}

.docs-table tr:hover td { background: #fafbfc; }

/* ── Status badges ──────────────────────────────── */
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600;
    padding: 3px 9px; border-radius: 20px;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge--blue   { background: #dbeafe; color: #1d4ed8; }
.status-badge--green  { background: #d1fae5; color: #065f46; }
.status-badge--orange { background: #fef3c7; color: #92400e; }
.status-badge--red    { background: #fee2e2; color: #991b1b; }
.status-badge--gray   { background: #f3f4f6; color: #6b7280; }

/* ── Code ───────────────────────────────────────── */
code {
    font-family: var(--font-mono);
    font-size: 12.5px;
    background: #f3f4f6;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    color: #be123c;
}

.code-block {
    font-family: var(--font-mono);
    font-size: 12.5px;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: var(--radius-md);
    padding: 16px 18px;
    overflow-x: auto;
    margin: 12px 0;
    line-height: 1.7;
    white-space: pre;
}

/* ── Expandable ─────────────────────────────────── */
.expandable {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin: 8px 0;
    overflow: hidden;
}

.expandable summary {
    padding: 11px 16px;
    font-size: 13.5px; font-weight: 500;
    cursor: pointer; list-style: none;
    background: var(--color-bg);
    display: flex; justify-content: space-between; align-items: center;
    color: var(--color-text-secondary);
    transition: background .12s;
}
.expandable summary::-webkit-details-marker { display: none; }
.expandable summary::after { content: '▸'; color: var(--color-text-light); font-size: 11px; transition: transform .2s; }
.expandable[open] summary::after { transform: rotate(90deg); }
.expandable summary:hover { background: var(--color-border-light); }

.expandable-body {
    padding: 14px 16px;
    font-size: 13.5px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

/* ── Two column ─────────────────────────────────── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 14px 0;
}
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }

/* ── Info cards ─────────────────────────────────── */
.info-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}
.info-card-label { font-size: 12px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 4px; }
.info-card-value { font-size: 14px; font-weight: 600; color: var(--color-text); margin-bottom: 3px; display: block; }
.info-card-note { font-size: 12px; color: var(--color-text-muted); }

/* ── Glossary ───────────────────────────────────── */
.glossary-list { margin: 0; }

.glossary-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light);
}
.glossary-item:last-child { border-bottom: none; }

.glossary-item dt {
    font-size: 13px; font-weight: 700;
    color: var(--color-text);
    padding-top: 1px;
}

.glossary-item dd {
    font-size: 13.5px;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* ── Page nav ───────────────────────────────────── */
.page-nav {
    border-top: 1px solid var(--color-border);
    padding: 24px 48px;
    display: flex; justify-content: space-between;
    max-width: 820px; margin: 0 auto;
}

.page-nav-link {
    display: flex; flex-direction: column; gap: 3px;
    text-decoration: none; padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color .15s, box-shadow .15s;
    max-width: 220px;
}
.page-nav-link:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(108,99,255,.08);
    text-decoration: none;
}
.page-nav-label { font-size: 11px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.page-nav-title { font-size: 13.5px; font-weight: 600; color: var(--color-text); }
.page-nav-link--prev { text-align: left; }
.page-nav-link--next { text-align: right; margin-left: auto; }

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .sidebar-right { display: none; }
}

@media (max-width: 900px) {
    .sidebar-left {
        position: fixed;
        left: 0; top: var(--header-height);
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 150;
        box-shadow: var(--shadow-md);
    }
    .sidebar-left.open { transform: translateX(0); }
    .docs-content { padding: 28px 24px 48px; }
    .mobile-menu-btn { display: flex; }
}

@media (max-width: 600px) {
    .docs-content { padding: 20px 16px 40px; }
    .menu-cards-grid { grid-template-columns: 1fr 1fr; }
    .sim-table-head { display: none; }
}
