/* Documentation 頁面專用樣式 */

/* 文檔內容區域 */
.documentation-content-area {
    line-height: 1.8;
    color: #374151;
}

[data-theme="dark"] .documentation-content-area {
    color: var(--text-color);
}

.doc-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="dark"] .doc-section {
    border-bottom: 1px solid var(--border-color);
}

.doc-section:last-child {
    border-bottom: none;
}

.doc-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

[data-theme="dark"] .doc-section h2 {
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.doc-section h2:first-child {
    margin-top: 0;
}

.doc-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

[data-theme="dark"] .doc-section h3 {
    color: var(--text-color);
}

.doc-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 1.5rem 0 0.75rem 0;
}

[data-theme="dark"] .doc-section h4 {
    color: var(--text-color);
}

.doc-content p {
    margin-bottom: 1rem;
    color: #374151;
}

[data-theme="dark"] .doc-content p {
    color: var(--text-color);
}

.doc-content ul,
.doc-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.doc-content li {
    margin-bottom: 0.5rem;
    color: #374151;
}

[data-theme="dark"] .doc-content li {
    color: var(--text-color);
}

/* 程式碼區塊 - 終端機樣式 */
.code-block {
    background: #0d1117;
    border-radius: var(--border-radius-sm);
    margin: 1.5rem 0;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid #30363d;
}

.code-header {
    background: #21262d;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #30363d;
    color: #f0f6fc;
    position: relative;
}

.code-header::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #ff5f56;
    border-radius: 50%;
    box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27ca3f;
}

.code-header span {
    color: #f0f6fc;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 4rem;
}

.copy-btn {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: #30363d;
    color: #f0f6fc;
}

.code-block pre {
    margin: 0;
    padding: 1.5rem;
    color: #e6edf3;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
    background: #0d1117;
    position: relative;
}

.code-block pre::after {
    content: '█';
    color: #e6edf3;
    animation: blink 1s infinite;
    font-weight: normal;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.code-block code {
    color: #e6edf3;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 內聯程式碼 */
.doc-content code {
    background: #0d1117;
    color: var(--error-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 資訊框 - 與 about.html 保持一致 */
.info-box,
.warning-box,
.success-box {
    margin: 2rem 0;
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    overflow: hidden;
    border-radius: 1rem;
    border: 1px solid rgba(14, 165, 233, 0.2);
    background-color: rgba(240, 249, 255, 0.5);
}

[data-theme="dark"] .info-box,
[data-theme="dark"] .warning-box,
[data-theme="dark"] .success-box {
    border-color: rgba(14, 165, 233, 0.3);
    background-color: rgba(14, 165, 233, 0.1);
}

.warning-box {
    border: 1px solid rgba(234, 179, 8, 0.2);
    background-color: rgba(254, 252, 232, 0.5);
}

[data-theme="dark"] .warning-box {
    border-color: rgba(234, 179, 8, 0.3);
    background-color: rgba(234, 179, 8, 0.1);
}

.success-box {
    border: 1px solid rgba(34, 197, 94, 0.2);
    background-color: rgba(240, 253, 244, 0.5);
}

[data-theme="dark"] .success-box {
    border-color: rgba(34, 197, 94, 0.3);
    background-color: rgba(34, 197, 94, 0.1);
}

.info-box-icon,
.warning-box-icon,
.success-box-icon {
    margin-top: 0.125rem;
    width: 1rem;
    min-width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.info-box-icon svg,
.warning-box-icon svg,
.success-box-icon svg {
    width: 1rem;
    height: 1rem;
    color: rgb(14, 165, 233);
}

.warning-box-icon svg {
    color: rgb(234, 179, 8);
}

.success-box-icon svg {
    color: rgb(34, 197, 94);
}

.info-box-content,
.warning-box-content,
.success-box-content {
    font-size: 0.875rem;
    line-height: 1.75;
    color: rgb(12, 74, 110);
    min-width: 0;
    width: 100%;
}

[data-theme="dark"] .info-box-content,
[data-theme="dark"] .warning-box-content,
[data-theme="dark"] .success-box-content {
    color: rgb(186, 230, 253);
}

.warning-box-content {
    color: rgb(113, 63, 18);
}

[data-theme="dark"] .warning-box-content {
    color: rgb(254, 240, 138);
}

.success-box-content {
    color: rgb(22, 101, 52);
}

[data-theme="dark"] .success-box-content {
    color: rgb(187, 247, 208);
}

.info-box-content p,
.warning-box-content p,
.success-box-content p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.info-box-content strong,
.warning-box-content strong,
.success-box-content strong {
    font-weight: 600;
    color: inherit;
}

/* 功能列表 */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-list li::before {
    content: '✓';
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

/* API 端點 */
.api-endpoints {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.endpoint-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #0d1117;
    border-radius: var(--border-radius-sm);
    border: 1px solid #30363d;
    transition: all 0.2s ease;
    color: #e6edf3;
}

.endpoint-item:hover {
    background: #161b22;
    border-color: #58a6ff;
}

.endpoint-method {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 60px;
    text-align: center;
}

.endpoint-method.get {
    background: #dbeafe;
    color: #1d4ed8;
}

.endpoint-method.post {
    background: #dcfce7;
    color: #166534;
}

.endpoint-path {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    color: #e6edf3;
    font-weight: 600;
}

.endpoint-desc {
    color: #8b949e;
    font-size: 0.9rem;
    margin-left: auto;
}

/* 故障排除項目 */
.troubleshoot-item {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: var(--border-radius-sm);
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.troubleshoot-item h4 {
    color: #ffa657;
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin-left: 2rem;
}

.troubleshoot-item::before {
    content: '⚠️  ';
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    font-size: 1.2rem;
}

.troubleshoot-item p {
    margin-bottom: 0.75rem;
    color: #e6edf3;
    margin-left: 2rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.troubleshoot-item ul {
    margin-bottom: 0;
    padding-left: 3.5rem;
}

.troubleshoot-item li {
    color: #e6edf3;
    margin-bottom: 0.5rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    position: relative;
}

.troubleshoot-item li::before {
    content: '$ ';
    color: #58a6ff;
    font-weight: bold;
}

/* 頁面導航 */
.page-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #f1f5f9;
}

[data-theme="dark"] .page-navigation {
    border-top: 2px solid var(--border-color);
}

.nav-prev,
.nav-next {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #f8fafc;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    font-weight: 500;
}

[data-theme="dark"] .nav-prev,
[data-theme="dark"] .nav-next {
    background: var(--primary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.nav-prev:hover,
.nav-next:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

[data-theme="dark"] .nav-prev:hover,
[data-theme="dark"] .nav-next:hover {
    background: var(--hover-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 頁面大綱 - Claude Code 風格 */
.outline-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.outline-item {
    padding: 0;
}

.outline-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 400;
    transition: color 0.15s ease;
    display: block;
    padding: 0.375rem 0.5rem;
    line-height: 1.4;
}

[data-theme="dark"] .outline-link {
    color: #9ca3af;
}

.outline-link:hover {
    color: #111827;
}

[data-theme="dark"] .outline-link:hover {
    color: #f9fafb;
}

.outline-link.active {
    color: #2563eb;
    font-weight: 500;
}

[data-theme="dark"] .outline-link.active {
    color: #60a5fa;
}

/* 子標題列表 */
.outline-sublist {
    margin: 0;
    padding: 0;
}

.outline-subitem {
    padding: 0;
}

.outline-sublink {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 400;
    transition: color 0.15s ease;
    display: block;
    padding: 0.25rem 0.5rem 0.25rem 1.25rem;
    line-height: 1.4;
}

[data-theme="dark"] .outline-sublink {
    color: #9ca3af;
}

.outline-sublink:hover {
    color: #111827;
}

[data-theme="dark"] .outline-sublink:hover {
    color: #f9fafb;
}

.outline-sublink.active {
    color: #2563eb;
    font-weight: 500;
}

[data-theme="dark"] .outline-sublink.active {
    color: #60a5fa;
}

/* 下載按鈕 */
.download-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

[data-theme="dark"] .download-btn {
    background: var(--primary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.download-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

[data-theme="dark"] .download-btn:hover {
    background: var(--hover-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.download-btn i {
    color: #2563eb;
}

[data-theme="dark"] .download-btn i {
    color: var(--primary-color);
}

.download-btn:hover i {
    color: white;
}

[data-theme="dark"] .download-btn:hover i {
    color: var(--primary-color);
}

/* 視圖選項 */
.view-options {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

[data-theme="dark"] .view-btn {
    background: var(--primary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.view-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

[data-theme="dark"] .view-btn:hover {
    background: var(--hover-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.view-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

[data-theme="dark"] .view-btn.active {
    background: var(--hover-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 儀器摘要區域 */
.instruments-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.instrument-summary-item {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.instrument-summary-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.instrument-summary-item h4 {
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.instrument-summary-item h4 i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.instrument-summary-item p {
    color: var(--text-color);
    opacity: 0.85;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.instrument-summary-item p:last-child {
    margin-bottom: 0;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .doc-section h2 {
        font-size: 1.75rem;
    }

    .doc-section h3 {
        font-size: 1.25rem;
    }

    .endpoint-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .endpoint-desc {
        margin-left: 0;
    }

    .page-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-prev,
    .nav-next {
        width: 100%;
        justify-content: center;
    }

    .instruments-summary {
        grid-template-columns: 1fr;
    }
}
