/* ==========================================================================
   category.css - カテゴリ詳細ページ用スタイル
   ========================================================================== */

/* リセット
------------------------------------------------------------*/
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    overflow-y: scroll;
}
body {
    font-family: "M PLUS 1", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー
------------------------------------------------------------*/
.site-header {
    background: #222;
    color: #fff;
    padding: 6px 0;
    flex-shrink: 0;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
}
.header-logo {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* タイトルバー
------------------------------------------------------------*/
.title-bar {
    background: #1b47a0;
    padding: 10px 0;
    flex-shrink: 0;
}
.title-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    position: relative;
}
.title-bar-icon {
    width: auto;
    height: 28px;
    object-fit: contain;
    margin-right: 10px;
    border-radius: 4px;
}
.title-bar-text {
    color: #fff;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 2px;
    white-space: nowrap;
    margin-left: 2px;
    margin-top: -4px;
}
.title-bar-text a {
    color: #fff;
    text-decoration: none;
}
.title-bar-text a:hover {
    text-decoration: underline;
}
.title-bar-search {
    position: absolute;
    right: 20px;
    transform: translateX(-0%);
    width: 400px;
    display: flex;
    gap: 0;
}
.title-bar-search-input-wrap {
    flex: 1;
    position: relative;
}
.title-bar-search input {
    width: 100%;
    padding: 7px 28px 7px 34px;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.title-bar-search .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 13px;
}
.search-clear-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: none;
    background: #ccc;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    display: none;
    padding: 0;
}
.search-clear-btn:hover {
    background: #999;
}
.title-bar-search-btn {
    padding: 7px 14px;
    background: #e8820e;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.title-bar-search-btn:hover {
    background: #d0740c;
}

/* メインレイアウト
------------------------------------------------------------*/
.container {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 20px;
    width: 100%;
}
.main-layout {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* 左ツリー
------------------------------------------------------------*/
.left-pane {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 10px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
    position: sticky;
    top: 10px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}
.tree-category {
    margin-bottom: 2px;
}
.tree-category-header {
    display: flex;
    align-items: center;
    padding: 5px 6px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 12px;
    user-select: none;
    gap: 4px;
}
.tree-category-header:hover {
    background: #f0f0f0;
}
.tree-category-header.active {
    background: #e3f2fd;
    font-weight: bold;
}
.tree-toggle {
    font-size: 14px;
    flex-shrink: 0;
}
.tree-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
}
.tree-children {
    padding-left: 20px;
}
.tree-item {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 12px;
    user-select: none;
    gap: 4px;
    text-decoration: none;
    color: #333;
}
.tree-item:hover {
    background: #f0f0f0;
}
.tree-item.active {
    background: #fff3e0;
    font-weight: bold;
}
.tree-content-icon {
    flex-shrink: 0;
    font-size: 14px;
}

/* 右コンテンツ
------------------------------------------------------------*/
.right-pane {
    flex: 1;
    min-width: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
}

/* PC向け: コンテンツヘッダー
------------------------------------------------------------*/
.content-header {
    display: none;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    overflow: hidden;
}
.content-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.content-header-info {
    flex: 1;
    min-width: 0;
}
.content-header-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0 0 4px 0;
}
.content-header-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin: 0;
    max-width: 100%;
}
.content-header-desc a {
    color: #1976D2;
    text-decoration: underline;
}
.content-header-desc a:hover {
    color: #1565C0;
}
.content-header-actions {
    flex-shrink: 0;
}
.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #1976D2;
    text-decoration: none;
    padding: 6px 10px;
    background: #e3f2fd;
    border-radius: 4px;
    white-space: nowrap;
}
.contact-link:hover {
    background: #bbdefb;
    text-decoration: none;
}
.contact-icon {
    font-size: 14px;
}
@media (min-width: 769px) {
    .content-header {
        display: block;
        padding: 8px 16px;
    }
    .content-header-title {
        font-size: 15px;
        margin: 0 0 2px 0;
    }
    .content-header-desc {
        font-size: 13px;
    }
}
.content-iframe-wrap {
    width: 100%;
    overflow: hidden;
}
.content-iframe-wrap iframe {
    width: 100%;
    height: calc(100vh - 170px);
    border: none;
    display: block;
}
@media (min-width: 769px) {
    .content-iframe-wrap iframe {
        height: calc(100vh - 220px);
    }
}
.right-pane .placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 500px;
    color: #999;
    font-size: 14px;
}
/* 未登録（処理中）表示 */
.right-pane .placeholder.not-registered {
    flex-direction: column;
    gap: 16px;
    background: #fafafa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    margin: 20px;
    height: calc(100% - 40px);
}
.not-registered-icon {
    font-size: 48px;
    animation: spin 2s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.not-registered-message {
    font-size: 16px;
    font-weight: 500;
    color: #666;
}
.not-registered-sub {
    font-size: 13px;
    color: #999;
}
/* 中央ペインはPCでは非表示 */
.middle-pane {
    display: none;
}

/* フッター
------------------------------------------------------------*/
.site-footer {
    background: #222;
    color: #fff;
    padding: 10px 0;
    flex-shrink: 0;
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
    font-size: 11px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.footer-inner a { color: #fff; text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }
.footer-sep { color: rgba(255,255,255,0.4); }
.footer-copy { color: rgba(255,255,255,0.6); }

/* ハンバーガーメニューボタン（モバイル用）
------------------------------------------------------------*/
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    margin-right: 10px;
}

/* オーバーレイ（モバイル用）
------------------------------------------------------------*/
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}
.mobile-overlay.active {
    display: block;
}

/* TOPに戻るリンク（デフォルト非表示）
------------------------------------------------------------*/
.tree-top-link {
    display: none;
}

/* メニュータイトル（デフォルト非表示、モバイルのみ表示）
------------------------------------------------------------*/
.menu-title {
    display: none;
}

/* レスポンシブ対応
------------------------------------------------------------*/
@media (max-width: 768px) {
    .container {
        min-width: auto;
        padding: 10px;
    }
    .main-layout {
        flex-direction: column;
    }

    /* ハンバーガーメニューボタン表示 */
    .mobile-menu-btn {
        display: block;
        font-size: 19px;
        padding: 3px;
        margin-right: 8px;
    }

    /* 左ペイン：スライドインメニュー化 */
    .left-pane {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        z-index: 999;
        border-radius: 0;
        border: none;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        transition: left 0.3s ease;
        padding-top: 15px;
    }
    .left-pane.open {
        left: 0;
    }
    .left-pane .menu-close-btn {
        display: block;
        position: absolute;
        top: 10px;
        right: 10px;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: #666;
    }

    /* メニュータイトル表示 */
    .menu-title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 15px;
        font-weight: 700;
        color: #1b47a0;
        padding: 8px 10px 12px 10px;
        border-bottom: 1px solid #ddd;
        margin-bottom: 10px;
        margin-right: 30px;
    }
    .menu-title-icon {
        width: auto;
        height: 24px;
        object-fit: contain;
        border-radius: 3px;
        flex-shrink: 0;
    }
    .menu-title span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* 右ペイン（iframe）をフル幅に */
    .right-pane {
        width: 100%;
        position: static;
    }
    .content-iframe-wrap iframe {
        height: calc(100vh - 140px);
    }

    /* タイトルバー検索 */
    .title-bar {
        padding: 4px 0;
    }
    .title-bar-inner {
        flex-wrap: wrap;
        gap: 2px;
    }
    .title-bar-text {
        font-size: 14px;
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    .title-bar-text a {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .title-bar-search {
        position: static;
        transform: none;
        width: 100%;
        order: 3;
        margin-top: 2px;
    }
    .title-bar-search input {
        font-size: 16px; /* iOS拡大防止 */
    }

    /* TOPに戻るリンク表示 */
    .tree-top-link {
        display: block;
        margin-top: 15px;
        padding: 10px 12px;
        background: #f5f5f5;
        border-radius: 5px;
        color: #1b47a0;
        text-decoration: none;
        font-size: 13px;
        font-weight: 500;
    }
    .tree-top-link:hover {
        background: #e8e8e8;
    }
    .tree-top-icon {
        margin-right: 5px;
    }
}

@media (max-width: 480px) {
    .header-inner {
        padding: 0 10px;
    }
    .title-bar-inner {
        padding: 0px 10px 2px 10px;
    }
    .title-bar-text {
        font-size: 14px;
    }
    .content-iframe-wrap iframe {
        height: calc(100vh - 160px);
    }
}
