/* モダンなQ&Aツリー用フロントエンドスタイル - 修正版 */
.qa-tree {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    background-color: #f9f9f9;
    position: relative;
}

/* 質問アイテム */
.qa-item {
    margin-bottom: 16px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #eaeaea;
    position: relative;
}

/* 質問ヘッダー */
.qa-item-header {
    padding: 18px 22px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 10px;
    background: #fff;
    z-index: 2;
}

.qa-item-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    flex-grow: 1;
    padding-right: 40px;
}

/* ホバー時のヘッダー色変更 */
.qa-item-header:hover {
    background: #f8f9fa;
}

.qa-item-header:hover h3 {
    color: #3498db;
}

/* 質問内容 - アコーディオン */
.qa-item-content {
    background: #fff;
    overflow: hidden;
    padding: 0 22px;
    display: none;
}

/* アクティブ状態 */
.qa-item.is-active {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0f2fe;
}

.qa-item.is-active .qa-item-content {
    border-top: 1px solid #f0f0f0;
}

.qa-answer {
    font-size: 15px;
    line-height: 1.6;
    color: #505050;
}

/* サブアイテム */
.qa-sub-items {
    margin-top: 20px;
    margin-left: 10px;
    padding-left: 20px;
    border-left: 2px solid #e0f2fe;
}

/* 展開/折りたたみアイコン */
.qa-item-header:after {
    content: '+';
    position: absolute;
    right: 20px;
    font-size: 18px;
    color: #999;
    font-weight: 300;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    border-radius: 50%;
}

.qa-item.is-active .qa-item-header:after {
    content: '−';
    color: #3498db;
}

/* モーダル表示ボタン */
.qa-modal-btn {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
    z-index: 3;
}

.qa-modal-btn:hover {
    background: #2980b9;
}

/* モーダルオーバーレイ */
.qa-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
    opacity: 0;
}

.qa-modal-overlay.is-active {
    display: block;
    opacity: 1;
}

/* モーダルコンテナ - 右側配置 */
.qa-modal-container {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: 50%;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 20px;
    pointer-events: none;
}

/* モーダル */
.qa-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 100%;
    position: relative;
    transform: translateX(100%);
    opacity: 0;
    max-height: 80vh;
    overflow-y: auto;
    pointer-events: auto;
    border-left: 5px solid #3498db;
}

.qa-modal.is-active {
    transform: translateX(0);
    opacity: 1;
}

/* モーダルの階層関係 */
.qa-modal[data-level="1"] {
    z-index: 102;
}

.qa-modal[data-level="2"] {
    z-index: 103;
    margin-right: 40px;
    border-left-color: #2ecc71;
}

.qa-modal[data-level="3"] {
    z-index: 104;
    margin-right: 80px;
    border-left-color: #9b59b6;
}

.qa-modal-inner {
    padding: 30px;
}

.qa-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: #f0f0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #666;
}

.qa-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.qa-modal-title {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eaeaea;
    font-size: 22px;
    color: #2c3e50;
}

.qa-modal-content {
    font-size: 16px;
    line-height: 1.6;
    color: #505050;
}

/* モーダル内の子項目 */
.qa-modal-sub-items {
    margin-top: 30px;
}

.qa-modal-sub-items h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #555;
    font-weight: 500;
}

.qa-modal-item {
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
}

.qa-modal-item:hover {
    background: #e3f2fd;
}

.qa-modal-item h4 {
    margin: 0;
    font-size: 15px;
    color: #3498db;
    font-weight: 500;
}

/* レスポンシブ対応 */
@media (max-width: 992px) {
    .qa-modal-container {
        width: 70%;
    }
}

@media (max-width: 768px) {
    .qa-tree {
        padding: 15px;
    }
    
    .qa-item-header {
        padding: 15px;
    }
    
    .qa-item.is-active .qa-item-content {
        padding: 15px;
    }
    
    .qa-modal-container {
        width: 100%;
        padding: 10px;
    }
    
    .qa-modal-inner {
        padding: 20px;
    }
    
    .qa-modal[data-level="2"],
    .qa-modal[data-level="3"] {
        margin-right: 0;
    }
    
    .qa-modal-btn {
        right: 50px;
        padding: 4px 8px;
        font-size: 12px;
    }
}