/**
 * 目次のスタイル - モダンデザイン
 */
.table-of-contents {
    background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
    border: none;
    border-radius: 16px;
    padding: 28px;
    margin: 40px 0;
    max-width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.table-of-contents::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #BF0000 0%, #FF0033 100%);
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 0;
    border-bottom: none;
}

.toc-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    position: relative;
    padding-left: 20px;
}

.toc-header h4::before {
    content: '📑';
    position: absolute;
    left: 0;
    font-size: 1rem;
}

.toc-toggle {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.toc-toggle:hover {
    background-color: #f5f5f5;
    border-color: #BF0000;
}

.toc-toggle-icon {
    font-size: 1.2rem;
    color: #666;
    font-weight: bold;
}

.toc-content {
    transition: all 0.3s ease;
}

.toc-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    counter-reset: toc-counter;
}

.toc-item {
    counter-increment: toc-counter;
    margin-bottom: 12px;
    position: relative;
}

.toc-link {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #4a5568;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.6;
}

.toc-link::before {
    content: counter(toc-counter);
    position: absolute;
    left: 15px;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    background: linear-gradient(135deg, #BF0000 0%, #FF0033 100%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(191, 0, 0, 0.3);
}

.toc-item .toc-link {
    padding-left: 50px;
}

.toc-link:hover {
    background-color: #fff5f5;
    color: #BF0000;
    text-decoration: none;
    transform: translateX(4px);
}

.toc-sublist {
    list-style: none;
    padding-left: 35px;
    margin-top: 8px;
    margin-bottom: 8px;
    counter-reset: toc-sub-counter;
}

.toc-subitem {
    counter-increment: toc-sub-counter;
    margin-bottom: 8px;
    position: relative;
}

.toc-subitem .toc-link {
    font-size: 0.9rem;
    padding: 8px 12px;
    padding-left: 40px;
    color: #6b7280;
}

.toc-subitem .toc-link::before {
    content: counter(toc-counter) "." counter(toc-sub-counter);
    left: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    background: #f3f4f6;
    color: #6b7280;
    width: auto;
    min-width: 28px;
    height: 20px;
    padding: 0 6px;
    border-radius: 4px;
    box-shadow: none;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .table-of-contents {
        padding: 20px;
        margin: 25px 0;
        border-radius: 12px;
    }
    
    .toc-header h4 {
        font-size: 1.1rem;
    }
    
    .toc-link {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .toc-item .toc-link {
        padding-left: 45px;
    }
    
    .toc-link::before {
        width: 22px;
        height: 22px;
        font-size: 0.8rem;
    }
    
    .toc-subitem .toc-link {
        font-size: 0.85rem;
        padding: 6px 10px;
        padding-left: 35px;
    }
    
    .toc-subitem .toc-link::before {
        font-size: 0.75rem;
        min-width: 26px;
        height: 18px;
    }
}

/* 印刷時は目次を非表示 */
@media print {
    .table-of-contents {
        display: none;
    }
}

/* スムーススクロール時のハイライト */
.toc-link.active {
    background-color: #fff0f0;
    color: #BF0000;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(191, 0, 0, 0.1);
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-of-contents {
    animation: fadeIn 0.4s ease-out;
}