/**
 * 使用手冊樣式（public/manual/index.html）。
 * 內容安全政策為 style-src 'self'，因此樣式一律放在本檔，不使用 inline style。
 */

:root {
    --manual-accent: #0d6efd;
    --manual-admin: #6f42c1;
    --manual-muted: #6c757d;
    --manual-border: #dee2e6;
    --manual-soft: #f8f9fa;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
}

body {
    background: #fff;
    line-height: 1.75;
}

/* ── 頂端 ─────────────────────────────────────────────────── */
.manual-header {
    background: #212529;
    color: #fff;
}

.manual-header a {
    color: #fff;
}

.manual-hero {
    background: linear-gradient(135deg, #e9f2ff 0%, #f3ecff 100%);
    border-bottom: 1px solid var(--manual-border);
}

.audience-card {
    border-left: 4px solid var(--manual-accent);
}

.audience-card.admin {
    border-left-color: var(--manual-admin);
}

/* ── 目錄 ─────────────────────────────────────────────────── */
@media (min-width: 992px) {
    .manual-toc {
        position: sticky;
        top: 72px;
        max-height: calc(100vh - 88px);
        overflow-y: auto;
    }
}

.manual-toc a {
    color: #212529;
    text-decoration: none;
    display: block;
    padding: 0.15rem 0;
}

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

.manual-toc .toc-part {
    font-weight: 700;
    margin-top: 1rem;
}

.manual-toc .toc-part.admin {
    color: var(--manual-admin);
}

.manual-toc ul {
    list-style: none;
    padding-left: 0.75rem;
    margin-bottom: 0;
    font-size: 0.925rem;
}

/* ── 內文 ─────────────────────────────────────────────────── */
.part-title {
    border-bottom: 3px solid var(--manual-accent);
    padding-bottom: 0.5rem;
    margin-top: 2.5rem;
}

.part-title.admin {
    border-bottom-color: var(--manual-admin);
}

.manual-section {
    padding-top: 1.5rem;
}

.manual-section h3 {
    font-size: 1.35rem;
    margin-top: 0.5rem;
}

.manual-section h4 {
    font-size: 1.1rem;
    margin-top: 1.25rem;
}

/* 畫面上的按鈕／選單名稱 */
.ui {
    display: inline-block;
    padding: 0 0.4em;
    border: 1px solid #adb5bd;
    border-radius: 0.25rem;
    background: var(--manual-soft);
    font-size: 0.9em;
    line-height: 1.5;
    white-space: nowrap;
}

/* 步驟清單 */
ol.steps {
    counter-reset: step;
    list-style: none;
    padding-left: 0;
}

ol.steps > li {
    counter-increment: step;
    position: relative;
    padding-left: 2.25rem;
    margin-bottom: 0.6rem;
}

ol.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0.15rem;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--manual-accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.6rem;
}

.admin-part ol.steps > li::before {
    background: var(--manual-admin);
}

/* 流程圖 */
.flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.flow-node {
    border: 2px solid var(--manual-accent);
    border-radius: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: #fff;
    text-align: center;
    min-width: 7rem;
}

.flow-node small {
    display: block;
    color: var(--manual-muted);
}

.flow-node.done {
    border-color: #198754;
}

.flow-arrow {
    color: var(--manual-muted);
    font-size: 1.25rem;
}

/* 狀態標籤顏色（與系統一致） */
.text-bg-orange {
    background-color: #fd7e14;
    color: #fff;
}

.table-manual th {
    background: var(--manual-soft);
    white-space: nowrap;
}

.table-manual td,
.table-manual th {
    vertical-align: top;
}

code.cmd {
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
    background: #212529;
    color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.manual-footer {
    border-top: 1px solid var(--manual-border);
    color: var(--manual-muted);
    font-size: 0.875rem;
}

.footer-watermark {
    position: fixed;
    bottom: 5px;
    right: 10px;
    font-size: 8pt;
    color: #adb5bd;
    opacity: 0.7;
    z-index: 9999;
    user-select: none;
    pointer-events: none;
}

/* ── 列印 ─────────────────────────────────────────────────── */
@media print {
    .no-print,
    .manual-toc,
    .manual-header {
        display: none !important;
    }

    .col-lg-9 {
        width: 100% !important;
    }

    .manual-section,
    .part-title {
        break-inside: avoid-page;
    }

    a[href^="#"] {
        color: inherit;
        text-decoration: none;
    }
}
