/* Shared Documentation Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent: #0066cc;
    --accent-light: #e6f0fa;
    --text: #1a1a1a;
    --text-muted: #606266;
    --border: #e0e0e0;
    --bg: #ffffff;
    --bg-alt: #f9fafb;
    --sidebar-width: 260px;
    --header-height: 96px;
    --max-width: 1400px;
}

body {
    font-family: 'HarmonyOS Sans SC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    line-height: 1.6;
    background: var(--bg);
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.12);
    background: var(--bg);
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo-img {
    height: var(--header-height);
    width: auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-alt);
    width: 240px;
}

.search-box svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    color: var(--text);
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-shortcut {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: inherit;
    white-space: nowrap;
}

nav a {
    color: var(--text);
    text-decoration: none;
    margin-left: 32px;
    font-size: 0.925rem;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--accent);
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #0055aa;
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Layout Wrapper */
.layout {
    max-width: var(--max-width);
    margin: 0 auto;
    margin-top: var(--header-height);
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: var(--header-height);
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 24px 0;
    background: var(--bg);
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 24px;
    margin-bottom: 8px;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav a {
    display: block;
    padding: 8px 24px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.sidebar-nav a:hover {
    color: var(--accent);
    background: var(--bg-alt);
}

.sidebar-nav a.active {
    color: var(--accent);
    background: var(--accent-light);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Main Content */
.main {
    flex: 1;
    min-width: 0;
    position: relative;
}

.content {
    max-width: 800px;
    padding: 48px 48px 100px;
}

/* Typography */
.content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
}

.content p {
    margin-bottom: 16px;
    color: var(--text);
}

.content .lead {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    line-height: 1.6;
}

.content ul, .content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.content li {
    margin-bottom: 8px;
}

.content a {
    color: var(--accent);
    text-decoration: none;
}

.content a:hover {
    text-decoration: underline;
}

/* Code Blocks */
.code-block {
    background: #1e1e1e;
    border-radius: 8px;
    margin: 24px 0;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #323232;
    border-bottom: 1px solid #404040;
}

.code-lang {
    font-size: 0.75rem;
    color: #888;
    font-weight: 500;
}

.code-copy {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.code-copy:hover {
    color: #fff;
}

.code-copy svg {
    width: 14px;
    height: 14px;
}

.code-block pre {
    padding: 16px 20px;
    overflow-x: auto;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e0e0e0;
}

.code-block code {
    font-family: inherit;
}

/* Inline Code */
.content code {
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.875em;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text);
}

.code-block code {
    background: transparent;
    border: none;
    padding: 0;
}

/* Syntax Highlighting */
.token-comment { color: #6a9955; }
.token-keyword { color: #569cd6; }
.token-string { color: #ce9178; }
.token-function { color: #dcdcaa; }
.token-variable { color: #9cdcfe; }
.token-number { color: #b5cea8; }
.token-operator { color: #d4d4d4; }
.token-prompt { color: #27ca40; }

/* Callouts */
.callout {
    padding: 16px 20px;
    border-radius: 8px;
    margin: 24px 0;
    border-left: 4px solid;
}

.callout-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.callout-title svg {
    width: 18px;
    height: 18px;
}

.callout p {
    margin: 0;
    font-size: 0.925rem;
}

.callout.info {
    background: var(--accent-light);
    border-color: var(--accent);
}

.callout.info .callout-title {
    color: var(--accent);
}

.callout.warning {
    background: #fff8e6;
    border-color: #f5a623;
}

.callout.warning .callout-title {
    color: #b87c00;
}

.callout.success {
    background: #e6f7e9;
    border-color: #27ca40;
}

.callout.success .callout-title {
    color: #1b8a2e;
}

/* Tables */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

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

.content th {
    background: var(--bg-alt);
    font-weight: 600;
    font-size: 1rem;
}

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

.content tr:hover {
    background: var(--bg-alt);
}

.content td.highlight-cell {
    color: var(--accent);
    font-weight: 600;
}

/* Steps */
.steps {
    counter-reset: step;
    list-style: none;
    padding-left: 0;
    margin: 24px 0;
}

.steps li {
    position: relative;
    padding-left: 48px;
    padding-bottom: 24px;
    border-left: 2px solid var(--border);
    margin-left: 15px;
}

.steps li:last-child {
    border-left: 2px solid transparent;
    padding-bottom: 0;
}

.steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: -16px;
    top: 0;
    width: 30px;
    height: 30px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.steps h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.steps p {
    margin-bottom: 12px;
    color: var(--text-muted);
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

.card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.1);
    text-decoration: none;
}

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

.card-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--accent);
}

.card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

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

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

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

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb svg {
    width: 14px;
    height: 14px;
}

/* Table of Contents (Right Sidebar) */
.toc {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    width: 220px;
    flex-shrink: 0;
    height: fit-content;
    max-height: calc(100vh - var(--header-height) - 48px);
    overflow-y: auto;
    padding: 0 24px 24px 0;
    margin-left: auto;
}

.toc-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.toc-list {
    list-style: none;
    border-left: 1px solid var(--border);
}

.toc-list a {
    display: block;
    padding: 6px 0 6px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    line-height: 1.4;
    transition: all 0.2s;
    border-left: 2px solid transparent;
    margin-left: -1px;
}

.toc-list a:hover {
    color: var(--accent);
}

.toc-list a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
}

.toc-list .toc-h3 {
    padding-left: 28px;
    font-size: 0.75rem;
}

/* Adjust main content when TOC is present */
.main-with-toc {
    display: flex;
    gap: 24px;
}

.main-with-toc .content {
    flex: 1;
    min-width: 0;
}

/* Page Nav */
.page-nav {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.page-nav-link {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.2s;
}

.page-nav-link:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.page-nav-link.next {
    text-align: right;
}

.page-nav-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.page-nav-title {
    font-weight: 600;
    color: var(--accent);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
    stroke: var(--text);
}

/* UI Mockups */
.ui-mockup {
    margin: 24px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f2;
}

.ui-mockup-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ui-mockup-label svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-muted);
}

.ui-mockup-content {
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 12px;
}

/* Scoped mockup styles */
.mock-app { background: #fff; border: 0.5px solid rgba(0,0,0,0.15); border-radius: 8px; overflow: hidden; }
.mock-nav { background: #0f1724; color: #fff; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; }
.mock-nav-left { display: flex; align-items: center; gap: 20px; }
.mock-brand { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 12px; }
.mock-tabs { display: flex; gap: 14px; font-size: 10px; color: #cbd5e1; }
.mock-tabs .active { color: #fff; }
.mock-user { font-size: 10px; color: #cbd5e1; }
.mock-body { background: #f5f5f2; padding: 14px 16px; }
.mock-search { background: #fff; border: 0.5px solid rgba(0,0,0,0.15); border-radius: 9999px; padding: 6px 12px; font-size: 10px; color: #888; margin-bottom: 10px; }
.mock-create { font-size: 10px; color: #185FA5; margin-bottom: 12px; cursor: pointer; }
.mock-head, .mock-row { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 8px 4px; border-bottom: 0.5px solid rgba(0,0,0,0.15); font-size: 10px; }
.mock-head { font-size: 9px; color: #888; text-transform: uppercase; }
.mock-row:last-child { border-bottom: none; }
.mock-id { color: #185FA5; }
.mock-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #3B6D11; margin-right: 4px; }
.mock-header { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; background: #f5f5f2; }
.mock-title { font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.mock-save { font-size: 11px; color: #185FA5; cursor: pointer; }
.mock-card { margin: 0 16px 16px; background: #fff; border: 0.5px solid rgba(0,0,0,0.15); border-radius: 8px; padding: 16px 20px; }
.mock-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; }
.mock-field { display: flex; align-items: center; gap: 8px; font-size: 10px; }
.mock-field label { color: #5F5E5A; min-width: 80px; text-align: right; }
.mock-field .req { color: #E24B4A; }
.mock-field input { flex: 1; border: 0.5px solid rgba(0,0,0,0.15); border-radius: 6px; padding: 5px 8px; font-size: 10px; max-width: 180px; background: #fff; }
.mock-field input.focus { border-color: #378ADD; }
.mock-select { border: 0.5px solid rgba(0,0,0,0.15); border-radius: 6px; padding: 5px 8px; font-size: 10px; background: #f1efe8; color: #888; display: flex; align-items: center; gap: 4px; }
.mock-toggle { display: inline-flex; border: 0.5px solid rgba(0,0,0,0.15); border-radius: 6px; overflow: hidden; }
.mock-toggle .on { background: #7f9ce6; color: #fff; padding: 4px 12px; font-size: 10px; }
.mock-toggle .off { background: #fff; color: #5F5E5A; padding: 4px 12px; font-size: 10px; }
.mock-pill-btn { background: #7f9ce6; color: #fff; border: none; border-radius: 9999px; padding: 4px 12px; font-size: 9px; cursor: pointer; }
.mock-badge { font-size: 9px; padding: 2px 8px; border-radius: 6px; display: inline-block; }
.mock-b-ok { background: #EAF3DE; color: #3B6D11; }
.mock-b-fail { background: #FCEBEB; color: #A32D2D; }
.mock-b-neutral { background: #F1EFE8; color: #5F5E5A; }
.mock-panel { margin: 0 16px 12px; background: #fff; border: 0.5px solid rgba(0,0,0,0.15); border-radius: 8px; padding: 12px 16px; }
.mock-panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 11px; font-weight: 500; }
.mock-dropzone { border: 1px dashed rgba(0,0,0,0.3); border-radius: 6px; padding: 20px; text-align: center; font-size: 10px; color: #5F5E5A; }
.mock-dropzone .link { color: #185FA5; }
.mock-config { background: #E6F1FB; border-radius: 6px; padding: 10px 12px; margin-top: 10px; }
.mock-config-title { font-size: 9px; font-weight: 500; color: #0C447C; margin-bottom: 8px; display: flex; align-items: center; gap: 4px; }
.mock-config-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: 9px; }
.mock-config-item .lbl { color: #0C447C; font-size: 8px; }
.mock-config-item .val { font-weight: 500; color: #042C53; }
.mock-config-item .green { color: #3B6D11; }
.mock-filters { display: flex; gap: 10px; margin-bottom: 12px; font-size: 10px; align-items: center; }
.mock-filter-search { display: flex; align-items: center; flex: 1; background: #fff; border: 0.5px solid rgba(0,0,0,0.15); border-radius: 9999px; padding: 4px 12px; }
.mock-filter-search input { border: none; background: transparent; font-size: 10px; outline: none; flex: 1; }
.mock-table { background: #fff; border: 0.5px solid rgba(0,0,0,0.15); border-radius: 8px; padding: 4px 12px 10px; }
.mock-trow { display: grid; grid-template-columns: 2fr 0.8fr 0.8fr 1fr 1.2fr; align-items: center; padding: 8px 4px; border-bottom: 0.5px solid rgba(0,0,0,0.15); font-size: 9px; }
.mock-trow:last-child { border-bottom: none; }
.mock-trow.head { color: #888; text-transform: uppercase; font-size: 8px; }
.mock-ops { display: flex; gap: 8px; font-size: 9px; color: #185FA5; }
.mock-send-btn { background: #378ADD; color: #fff; border: none; border-radius: 6px; padding: 6px 14px; font-size: 10px; cursor: pointer; }
.mock-file-row { background: #f5f5f2; border-radius: 6px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 10px; }
.mock-section { padding-bottom: 14px; border-bottom: 0.5px solid rgba(0,0,0,0.15); margin-bottom: 14px; }
.mock-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* Search Modal */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.search-modal.open {
    display: block;
}

.search-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.search-modal-content {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 560px;
    background: var(--bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.search-modal-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.search-modal-input-wrap svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
    flex-shrink: 0;
}

.search-modal-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
    color: var(--text);
}

.search-modal-input::placeholder {
    color: var(--text-muted);
}

.search-modal-esc {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 4px;
}

.search-modal-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.search-modal-hint {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.search-modal-result {
    display: block;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.search-modal-result:hover,
.search-modal-result.selected {
    background: var(--accent-light);
}

.search-modal-result-title {
    font-weight: 600;
    font-size: 0.925rem;
    color: var(--text);
    margin-bottom: 4px;
}

.search-modal-result-snippet {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 1200px) {
    .toc {
        display: none;
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 90;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .layout {
        display: block;
    }

    .content {
        padding: 32px 24px 80px;
    }

    .mobile-menu-btn {
        display: block;
    }

    .search-box {
        display: none;
    }

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

    .page-nav {
        flex-direction: column;
    }

    .page-nav-link.next {
        text-align: left;
    }

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

    .mock-config-grid {
        grid-template-columns: 1fr 1fr;
    }
}
