﻿/* ================================
   Doc Modal 通用樣式 - doc.css
   只給說明文件用，不影響其他頁面
   ================================ */

/* 根容器：所有 DocModal 外層加上 .doc-modal-root */
.doc-modal-root {
    width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    padding: 18px 20px 20px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    color: #111827;
    max-height: calc(100vh - 80px);
    overflow: hidden;
}

/* 標題列 */
.doc-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 12px;
}

.doc-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.doc-modal-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* 關閉按鈕 */
.doc-close-btn {
    appearance: none;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
    white-space: nowrap;
}

    .doc-close-btn:hover {
        background: #f3f4f6;
        border-color: #9ca3af;
        transform: translateY(-0.5px);
    }

/* 內文：左右兩欄布局 */
.doc-modal-body {
    display: flex;
    align-items: stretch;
    gap: 16px;
    margin-top: 4px;
    /* 讓內容可以在 modal 裡滾動 */
    overflow: hidden;
}

/* 側邊導覽欄 */
.doc-side-nav {
    width: 220px;
    border-right: 1px solid #e5e7eb;
    padding-right: 12px;
    padding-top: 4px;
    box-sizing: border-box;
    flex-shrink: 0;
    overflow-y: auto;
    max-height: calc(100vh - 160px);
}

.doc-side-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 6px;
}

.doc-side-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-side-nav li + li {
    margin-top: 4px;
}

.doc-nav-link {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, transform .05s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .doc-nav-link:hover {
        background: #eef2ff;
        color: #1f2937;
        transform: translateY(-0.5px);
    }

/* 右側內容區 */
.doc-main {
    flex: 1;
    padding-left: 4px;
    padding-right: 2px;
    box-sizing: border-box;
    overflow-y: auto;
    max-height: calc(90vh - 2em - 160px);
    scroll-behavior: smooth;
}

/* 內容區塊 section */
.doc-block {
    padding: 10px 0 12px;
    border-bottom: 1px dashed #e5e7eb;
}

    .doc-block:last-child {
        border-bottom: none;
        padding-bottom: 4px;
    }

    .doc-block h3 {
        margin: 0 0 6px;
        font-size: 16px;
        font-weight: 600;
        color: #111827;
    }

    .doc-block h4 {
        margin: 10px 0 4px;
        font-size: 14px;
        font-weight: 600;
        color: #111827;
    }

    /* 文字與列表 */
    .doc-block p {
        margin: 4px 0 6px;
        font-size: 13px;
        line-height: 1.6;
        color: #374151;
    }

    .doc-block ul,
    .doc-block ol {
        margin: 4px 0 6px 18px;
        padding: 0;
        font-size: 13px;
        line-height: 1.55;
        color: #4b5563;
    }

    .doc-block li + li {
        margin-top: 2px;
    }

    /* 行內 code / 關鍵字 */
    .doc-block code {
        font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
        font-size: 12px;
        padding: 1px 4px;
        border-radius: 4px;
        background: #f3f4f6;
        color: #1f2937;
    }

/* 小提醒區塊 */
.doc-note {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
    background: #eff6ff;
    color: #1d4ed8;
    border-left: 3px solid #3b82f6;
}

/* 小標籤 / badge 類 */
.doc-tag,
.doc-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1.2;
    background: #f3f4f6;
    color: #4b5563;
    gap: 4px;
}

.doc-badge--primary {
    background: #eef2ff;
    color: #4f46e5;
}

.doc-badge--danger {
    background: #fee2e2;
    color: #b91c1c;
}

.doc-badge--success {
    background: #dcfce7;
    color: #15803d;
}

/* 表格（若文件需要） */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0 8px;
    font-size: 13px;
}

    .doc-table th,
    .doc-table td {
        border: 1px solid #e5e7eb;
        padding: 6px 8px;
        text-align: left;
    }

    .doc-table th {
        background: #f9fafb;
        font-weight: 600;
    }

/* RWD：平板以下改直向堆疊 */
/* RWD：平板以下改直向堆疊 */
@media (max-width: 768px) {
    .doc-modal-root {
        width: 100%;
        padding: 14px 12px 12px;
        border-radius: 14px;
        /* 讓整個說明文件可以捲動，而不是只捲 doc-main */
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }

    .doc-modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .doc-modal-body {
        flex-direction: column;
        gap: 10px;
        /* 不要在 body 裡再切一層 scroll */
        overflow: visible;
    }

    .doc-side-nav {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding-right: 0;
        padding-bottom: 6px;
        display: flex;
        flex-direction: column;
        /* 解除原本的 max-height + scroll，改由外層捲動 */
        max-height: none;
        overflow-y: visible;
    }

        .doc-side-nav ul {
            display: flex;
            flex-wrap: wrap;
            gap: 4px;
            margin-top: 4px;
        }

        .doc-side-nav li {
            margin: 0;
        }

    .doc-nav-link {
        padding: 5px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .doc-main {
        /* 小螢幕改由整個 modal 捲動，不要在這裡再限制高度 */
        overflow: visible;
        max-height: none;
        padding-right: 0;
    }
}

/* 引言區塊（blockquote） */
.doc-block blockquote {
    margin: 6px 0;
    padding: 8px 10px;
    border-left: 3px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
    font-size: 13px;
    color: #4b5563;
}

/* 警示訊息區塊（黃色提醒） */
.doc-warning {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
    background: #fffbeb;
    color: #92400e;
    border-left: 3px solid #f59e0b;
}
