/* ドキュメントサイト専用スタイル */

:root {
    --docs-sidebar-width: 280px;
    --docs-toc-width: 220px;
    --docs-header-height: 70px;
    --docs-content-max-width: 900px;
    --docs-bg: #f8f9fa;
    --docs-sidebar-bg: #2d3748;
    --docs-sidebar-text: #e2e8f0;
    --docs-sidebar-active: #ff8fab;
    --docs-border: #e2e8f0;
    --docs-code-bg: #f5f5f5;
    --docs-code-border: #ddd;
    --docs-table-border: #ddd;
    --docs-link-color: #fb6f92;
}

/* ドキュメントページ専用のbodyスタイル */
body.docs-body {
    background-color: var(--docs-bg);
    padding-top: var(--docs-header-height);
}

/* ドキュメントヘッダー */
.docs-header {
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--docs-header-height);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--docs-border);
}

.docs-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.docs-header .logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-decoration: none;
}

.docs-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.docs-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.docs-nav a:hover {
    color: var(--primary-dark);
}

/* メインコンテナ */
.docs-container {
    min-height: calc(100vh - var(--docs-header-height));
}

/* サイドバー */
.docs-sidebar {
    background-color: var(--docs-sidebar-bg);
    color: var(--docs-sidebar-text);
    position: fixed;
    top: var(--docs-header-height);
    left: 0;
    width: var(--docs-sidebar-width);
    height: calc(100vh - var(--docs-header-height));
    overflow-y: auto;
    padding: 30px 0;
    border-right: 1px solid #1a202c;
}

.docs-sidebar::-webkit-scrollbar {
    width: 6px;
}

.docs-sidebar::-webkit-scrollbar-track {
    background: #1a202c;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

.docs-sidebar nav {
    padding: 0 20px;
}

.docs-sidebar-section {
    margin-bottom: 30px;
}

.docs-sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #a0aec0;
    margin-bottom: 10px;
    font-weight: 700;
}

.docs-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-sidebar li {
    margin: 0;
}

.docs-sidebar a {
    display: block;
    padding: 8px 12px;
    color: var(--docs-sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.docs-sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    padding-left: 16px;
}

.docs-sidebar a:visited {
    color: var(--docs-sidebar-text);
}

.docs-sidebar a.active {
    background-color: var(--docs-sidebar-active);
    color: white;
    font-weight: 600;
}

.docs-sidebar a.active:visited {
    color: white;
}

.docs-sidebar-subsection {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 2px solid #4a5568;
    margin-top: 5px;
}

.docs-sidebar-subsection a {
    font-size: 0.9rem;
    padding: 6px 12px;
}

/* メインコンテンツ */
.docs-main {
    margin-left: var(--docs-sidebar-width);
    margin-right: var(--docs-toc-width);
    padding: 40px 60px;
    background-color: white;
    min-height: calc(100vh - var(--docs-header-height));
}

.docs-content {
    /* max-widthを削除して利用可能な幅いっぱいに表示 */
}

/* ページ内目次 (Table of Contents) */
.docs-toc {
    position: fixed;
    top: var(--docs-header-height);
    right: 0;
    width: var(--docs-toc-width);
    height: calc(100vh - var(--docs-header-height));
    padding: 30px 20px;
    overflow-y: auto;
    border-left: 1px solid var(--docs-border);
    background-color: white;
}

.docs-toc::-webkit-scrollbar {
    width: 4px;
}

.docs-toc::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

.docs-toc h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #718096;
    margin-bottom: 15px;
    font-weight: 700;
}

.docs-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-toc li {
    margin: 0;
}

.docs-toc a {
    display: block;
    padding: 4px 0;
    color: #4a5568;
    text-decoration: none;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: color 0.2s;
    border-left: 2px solid transparent;
    padding-left: 8px;
}

.docs-toc a:hover {
    color: var(--primary-dark);
}

.docs-toc a.active {
    color: var(--primary-dark);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.docs-toc .toc-h3 {
    padding-left: 20px;
    font-size: 0.8rem;
}

/* コンテンツタイポグラフィ */
.docs-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.docs-content h2 {
    font-size: 2rem;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--docs-border);
    padding-bottom: 0.5rem;
}

.docs-content h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--text-color);
}

.docs-content h4 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.6rem;
    color: var(--text-color);
}

.docs-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--text-color);
}

.docs-content ul,
.docs-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
    line-height: 1.8;
}

.docs-content li {
    margin-bottom: 0.5rem;
}

.docs-content a {
    color: var(--docs-link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.docs-content a:hover {
    border-bottom-color: var(--docs-link-color);
}

/* コードブロック */
.docs-content pre {
    background-color: var(--docs-code-bg);
    border: 1px solid var(--docs-code-border);
    border-radius: 6px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    position: relative;
}

.docs-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.docs-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #2d3748;
}

.docs-content :not(pre) > code {
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    padding: 0.2em 0.4em;
    font-size: 0.85em;
    color: #d63384;
}

/* コピーボタン */
.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.3rem 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.docs-content pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: var(--primary-dark);
}

/* テーブル */
.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.docs-content th,
.docs-content td {
    border: 1px solid var(--docs-table-border);
    padding: 12px 15px;
    text-align: left;
}

.docs-content th {
    background-color: #f7fafc;
    font-weight: 600;
    color: var(--text-color);
}

.docs-content tr:nth-child(even) {
    background-color: #f9fafb;
}

.docs-content tr:hover {
    background-color: #fff5f7;
}

/* ブロッククォート */
.docs-content blockquote {
    border-left: 4px solid var(--primary-color);
    background-color: #fff5f7;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    color: #4a5568;
}

/* アラートボックス */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.alert-info {
    background-color: #e6f7ff;
    border-left-color: #1890ff;
    color: #003a8c;
}

.alert-warning {
    background-color: #fffbe6;
    border-left-color: #faad14;
    color: #7c4a03;
}

.alert-error {
    background-color: #fff2f0;
    border-left-color: #ff4d4f;
    color: #a8071a;
}

.alert-success {
    background-color: #f6ffed;
    border-left-color: #52c41a;
    color: #135200;
}

/* チェックリスト */
.docs-content .checklist {
    list-style: none;
    padding-left: 0;
}

.docs-content .checklist li {
    padding-left: 2rem;
    position: relative;
}

.docs-content .checklist li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.4em;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e0;
    border-radius: 3px;
    background: white;
}

.docs-content .checklist li.checked::before {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.docs-content .checklist li.checked::after {
    content: '✓';
    position: absolute;
    left: 4px;
    top: 0.2em;
    color: white;
    font-weight: bold;
    font-size: 0.9em;
}

/* ページネーション（前へ・次へ） */
.docs-pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--docs-border);
}

.docs-pagination a {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
    border: 1px solid var(--docs-border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    max-width: 45%;
}

.docs-pagination a:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(255, 143, 171, 0.2);
}

.docs-pagination .pagination-label {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 0.3rem;
}

.docs-pagination .pagination-title {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 600;
}

.docs-pagination .prev {
    text-align: left;
}

.docs-pagination .next {
    text-align: right;
    margin-left: auto;
}

/* 検索ボックス */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    padding: 100px 20px;
}

.search-overlay.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.search-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.search-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid var(--docs-border);
    border-radius: 8px;
    outline: none;
    font-family: var(--font-main);
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-results {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    padding: 15px;
    border-bottom: 1px solid var(--docs-border);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background-color: #f7fafc;
}

.search-result-title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}

.search-result-snippet {
    font-size: 0.9rem;
    color: #718096;
}

.search-result-path {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 5px;
}

/* ドキュメントフッター */
.docs-footer {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 30px 0;
    text-align: center;
    margin-left: var(--docs-sidebar-width);
}

.docs-footer a {
    color: var(--primary-color);
}

/* モバイルメニューボタン */
.mobile-sidebar-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 143, 171, 0.4);
    z-index: 999;
}

/* レスポンシブ対応 */
@media (max-width: 1199px) {
    .docs-toc {
        display: none;
    }
    
    .docs-main {
        margin-right: 0;
    }
    
    .docs-footer {
        margin-right: 0;
    }
}

@media (max-width: 991px) {
    .docs-main {
        padding: 30px 40px;
    }
}

@media (max-width: 767px) {
    .docs-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 1500;
    }
    
    .docs-sidebar.active {
        transform: translateX(0);
    }
    
    .docs-main {
        margin-left: 0;
        padding: 20px;
    }
    
    .docs-footer {
        margin-left: 0;
    }
    
    .mobile-sidebar-btn {
        display: block;
    }
    
    /* モバイルでサイドバーを開いた時の背景 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1400;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* プリントスタイル */
@media print {
    .docs-header,
    .docs-sidebar,
    .docs-toc,
    .docs-footer,
    .mobile-sidebar-btn {
        display: none;
    }
    
    .docs-main {
        margin: 0;
        padding: 0;
    }
    
    .docs-content {
        max-width: 100%;
    }
}
