/* ============================================================
   PharmaPro Docs — design system
   Inspired by stripe.com/docs and linear.app/docs
   ============================================================ */

:root {
    --bg:           #ffffff;
    --bg-alt:       #f8fafc;
    --bg-soft:      #f1f5f9;
    --bg-code:      #0f172a;
    --surface:      #ffffff;
    --border:       #e2e8f0;
    --border-soft:  #eef2f7;
    --border-strong:#cbd5e1;
    --ink:          #0f172a;
    --ink-2:        #1e293b;
    --text-2:       #475569;
    --text-3:       #64748b;
    --text-4:       #94a3b8;
    --brand:        #1d4ed8;
    --brand-hover:  #1e40af;
    --brand-light:  #dbeafe;
    --brand-soft:   #eff6ff;
    --accent:       #06b6d4;
    --ok:           #10b981;
    --warn:         #f59e0b;
    --bad:          #dc2626;
    --code-bg:      #0f172a;
    --code-text:    #e2e8f0;
    --code-comment: #64748b;
    --code-string:  #86efac;
    --code-key:     #93c5fd;
    --code-number:  #fcd34d;
    --shadow-sm:    0 1px 2px rgba(15,23,42,0.04);
    --shadow-md:    0 4px 12px -2px rgba(15,23,42,0.06), 0 2px 6px -1px rgba(15,23,42,0.04);
    --shadow-lg:    0 24px 48px -12px rgba(15,23,42,0.12), 0 8px 16px -4px rgba(15,23,42,0.06);
}

[data-theme="dark"] {
    --bg:           #0a0e1a;
    --bg-alt:       #0f1729;
    --bg-soft:      #1e293b;
    --surface:      #111827;
    --border:       #1f2937;
    --border-soft:  #1a2233;
    --border-strong:#374151;
    --ink:          #f9fafb;
    --ink-2:        #e2e8f0;
    --text-2:       #cbd5e1;
    --text-3:       #94a3b8;
    --text-4:       #64748b;
    --brand:        #60a5fa;
    --brand-light:  #1e3a8a;
    --brand-soft:   #1e293b;
    --shadow-sm:    0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:    0 24px 48px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.65;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
.lat, code, pre, kbd { font-family: 'JetBrains Mono', 'SF Mono', Menlo, Monaco, Consolas, monospace; font-feature-settings: "tnum" 1; }
.num-tabular { font-variant-numeric: tabular-nums; }

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

/* ============================================================
   LAYOUT
   ============================================================ */
.app {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}
@media (max-width: 1023px) {
    .app { grid-template-columns: 1fr; }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg);
    border-right: 1px solid var(--border-soft);
    padding: 20px 16px;
}
@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        z-index: 50;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    margin-bottom: 22px;
    text-decoration: none;
    color: var(--ink);
}
.brand-mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
.brand-text {
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.025em;
}
.brand-text .accent { color: var(--brand); }
.brand-badge {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--brand);
    letter-spacing: 0.02em;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-alt);
    color: var(--text-3);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.sidebar-search:hover { border-color: var(--border-strong); }
.sidebar-search svg { opacity: 0.6; flex-shrink: 0; }
.sidebar-search-text { flex: 1; }
.sidebar-search-kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-4);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg);
}

.nav-section { margin-bottom: 18px; }
.nav-title {
    text-transform: uppercase;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--text-4);
    padding: 4px 12px;
    margin-bottom: 4px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
    transition: background 0.12s, color 0.12s;
    position: relative;
}
.nav-link:hover {
    background: var(--bg-alt);
    color: var(--ink);
}
.nav-link.active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}
.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 4px;
    background: var(--brand);
}
.nav-badge {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, #06b6d4, #1d4ed8);
    color: white;
}

/* ============================================================
   HEADER (mobile)
   ============================================================ */
.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(10px);
}
@media (max-width: 1023px) { .topbar { display: flex; } }

.icon-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px;
    cursor: pointer;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--ink); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
    padding: 48px 64px 80px;
    max-width: 100%;
    overflow-x: hidden;
}
@media (max-width: 1023px) { .main { padding: 32px 24px 64px; } }

.content {
    max-width: 760px;
    margin: 0 auto;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--brand);
    margin-bottom: 12px;
}
h1 {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: var(--ink);
    margin: 0 0 14px;
}
h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--ink);
    margin: 48px 0 14px;
    scroll-margin-top: 24px;
}
h3 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.4;
    color: var(--ink);
    margin: 32px 0 10px;
    scroll-margin-top: 24px;
}
.lead {
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-2);
    margin: 0 0 32px;
}
p { margin: 0 0 16px; color: var(--text-2); }
.content > p, .content li { font-size: 15px; }

/* Inline code */
code:not(pre code) {
    font-size: 13px;
    background: var(--bg-soft);
    color: var(--ink);
    padding: 2px 6px;
    border-radius: 5px;
    border: 1px solid var(--border-soft);
    font-weight: 500;
}

/* Code block */
.code-block {
    position: relative;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-code);
    border: 1px solid #1e293b;
    box-shadow: var(--shadow-md);
}
.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid #1e293b;
    background: #0a0e1a;
}
.code-block-lang {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.code-block-copy {
    background: none;
    border: 1px solid #1e293b;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.code-block-copy:hover { color: white; border-color: #334155; }
.code-block-copy.copied { color: #10b981; border-color: #064e3b; background: #022c22; }
.code-block pre {
    margin: 0;
    padding: 16px 20px;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--code-text);
    overflow-x: auto;
}
.code-block .c-comment { color: var(--code-comment); }
.code-block .c-string { color: var(--code-string); }
.code-block .c-key { color: var(--code-key); }
.code-block .c-num { color: var(--code-number); }

/* ============================================================
   CALLOUTS
   ============================================================ */
.callout {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    margin: 20px 0;
    border-radius: 10px;
    border: 1px solid;
    font-size: 14px;
    line-height: 1.55;
}
.callout-info {
    background: var(--brand-soft);
    border-color: #c7d8fe;
    color: #1e3a8a;
}
.callout-warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #78350f;
}
.callout-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.callout-ok {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}
[data-theme="dark"] .callout-info  { background: #1e293b; border-color: #1e3a8a; color: #93c5fd; }
[data-theme="dark"] .callout-warn  { background: #1c1917; border-color: #78350f; color: #fcd34d; }
[data-theme="dark"] .callout-danger{ background: #1c1917; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .callout-ok    { background: #022c22; border-color: #064e3b; color: #6ee7b7; }
.callout-icon { flex-shrink: 0; margin-top: 1px; }
.callout-body { flex: 1; }
.callout strong { color: inherit; }

/* ============================================================
   STEP LIST (numbered guides)
   ============================================================ */
.steps { counter-reset: step; padding: 0; list-style: none; margin: 24px 0; }
.steps > li {
    counter-increment: step;
    position: relative;
    padding: 8px 0 24px 56px;
    border-left: 2px solid var(--border-soft);
    margin-left: 18px;
}
.steps > li::before {
    content: counter(step);
    position: absolute;
    left: -19px;
    top: 0;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--brand);
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 4px var(--bg);
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li > h3 { margin-top: 0; margin-bottom: 6px; }

/* ============================================================
   KEYBOARD SHORTCUTS
   ============================================================ */
kbd {
    display: inline-block;
    padding: 2px 7px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: var(--bg-alt);
    color: var(--ink);
    box-shadow: 0 1px 0 var(--border-strong);
    line-height: 1.4;
    margin: 0 1px;
}

/* ============================================================
   TABLES
   ============================================================ */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.content th, .content td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}
.content th {
    background: var(--bg-alt);
    font-weight: 700;
    color: var(--ink);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.content tr:last-child td { border-bottom: none; }
.content td { color: var(--text-2); }

/* ============================================================
   MOCKUP FRAME
   ============================================================ */
.mockup {
    margin: 24px 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow-lg);
}
.mockup-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #fbfcfd, #f5f7fb);
    border-bottom: 1px solid var(--border-soft);
}
.mockup-dots { display: flex; gap: 6px; }
.mockup-dot { width: 10px; height: 10px; border-radius: 50%; }
.mockup-dot.r { background: #fca5a5; }
.mockup-dot.y { background: #fcd34d; }
.mockup-dot.g { background: #86efac; }
.mockup-title {
    flex: 1;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--text-3);
}
.mockup-body { padding: 0; background: #fafbfc; }
.mockup-body svg { display: block; max-width: 100%; height: auto; }
.mockup-caption {
    padding: 10px 14px;
    border-top: 1px solid var(--border-soft);
    font-size: 12.5px;
    color: var(--text-3);
    text-align: center;
}

/* ============================================================
   HERO (landing page only)
   ============================================================ */
.hero {
    text-align: center;
    padding: 32px 0 56px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 48px;
}
.hero h1 { font-size: 44px; }
.hero .lead { max-width: 600px; margin: 14px auto 32px; }
.hero-cta-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.15s;
    cursor: pointer;
    border: 1px solid transparent;
}
.btn-primary {
    background: var(--brand);
    color: white;
    box-shadow: 0 4px 12px -2px rgba(29,78,216,0.4);
}
.btn-primary:hover {
    background: var(--brand-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -4px rgba(29,78,216,0.5);
}
.btn-ghost {
    background: var(--bg);
    color: var(--ink-2);
    border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--border-strong); color: var(--ink); }

/* ============================================================
   CARDS GRID (landing)
   ============================================================ */
.cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 24px 0;
}
@media (max-width: 700px) { .cards { grid-template-columns: 1fr; } }
.card {
    display: block;
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    transition: all 0.2s;
    color: inherit;
}
.card:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -12px rgba(29,78,216,0.16);
    color: inherit;
}
.card-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--brand-soft);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.card-title {
    font-weight: 700;
    color: var(--ink);
    font-size: 15px;
    margin-bottom: 4px;
}
.card-desc { font-size: 13px; color: var(--text-3); margin: 0; }

/* ============================================================
   PAGE NAVIGATION (prev/next at bottom)
   ============================================================ */
.page-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 80px 0 0;
    padding-top: 32px;
    border-top: 1px solid var(--border-soft);
}
.page-nav a {
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all 0.15s;
}
.page-nav a:hover { border-color: var(--brand); transform: translateY(-1px); }
.page-nav-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 700; }
.page-nav-title { font-weight: 600; color: var(--ink); margin-top: 4px; }
.page-nav-prev { text-align: left; }
.page-nav-next { text-align: right; grid-column: 2; }

/* ============================================================
   SEARCH OVERLAY
   ============================================================ */
.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(8px);
}
.search-overlay.open { display: flex; }
.search-modal {
    width: 100%;
    max-width: 580px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 32px 64px -16px rgba(0,0,0,0.4);
    overflow: hidden;
}
.search-modal input {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-bottom: 1px solid var(--border-soft);
    background: transparent;
    font-size: 15px;
    color: var(--ink);
    outline: none;
    font-family: inherit;
}
.search-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
}
.search-result {
    display: block;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 14px;
    transition: background 0.1s;
}
.search-result:hover { background: var(--bg-alt); color: var(--ink); }
.search-result-title { font-weight: 600; color: var(--ink); }
.search-result-section { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.search-empty { padding: 32px 14px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ============================================================
   FOOTER
   ============================================================ */
.docs-footer {
    margin: 80px 0 0;
    padding: 24px 0;
    border-top: 1px solid var(--border-soft);
    font-size: 12.5px;
    color: var(--text-3);
    text-align: center;
}
.docs-footer a { color: var(--text-2); }
.docs-footer .lat { font-size: 11.5px; }
