/* ===== Elite Piano Table of Contents ===== */
/* Brand: #1a1a1a (dark), #c5a47e (gold accent) */

.ep-toc {
    background: linear-gradient(135deg, #faf8f5 0%, #f5f0ea 100%);
    border: 1px solid rgba(197, 164, 126, 0.25);
    border-left: 4px solid #c5a47e;
    margin: 20px 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(197, 164, 126, 0.08);
    transition: box-shadow 0.3s ease, max-width 0.3s ease;
    width: fit-content;
    max-width: 100%;
}
.ep-toc.is-collapsed {
    max-width: 220px;
}
.ep-toc:hover {
    box-shadow: 0 4px 16px rgba(197, 164, 126, 0.15);
}

/* Header */
.ep-toc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.ep-toc-header:hover {
    background: rgba(197, 164, 126, 0.06);
}
.ep-toc-icon {
    color: #c5a47e;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(197, 164, 126, 0.12);
    flex-shrink: 0;
}
.ep-toc-icon svg {
    width: 16px;
    height: 16px;
}
.ep-toc-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1a1a1a;
    flex: 1;
    letter-spacing: 0.02em;
}
.ep-toc-count {
    font-size: 0.8rem;
    color: #777;
    background: rgba(197, 164, 126, 0.1);
    padding: 1px 6px;
    flex-shrink: 0;
}
.ep-toc-arrow {
    color: #c5a47e;
    font-size: 0.85rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.ep-toc.is-collapsed .ep-toc-arrow {
    transform: rotate(-90deg);
}

/* List */
.ep-toc-list,
.ep-toc-list ol,
.ep-toc-sublist {
    list-style: none !important;
    padding-left: 0 !important;
}
.ep-toc-list {
    margin: 0;
    padding: 0 18px 12px 18px;
    counter-reset: toc-h2;
    max-height: 600px;
    overflow-y: auto;
    transition: max-height 0.4s ease, padding 0.3s ease, opacity 0.3s ease;
}
.ep-toc.is-collapsed .ep-toc-list {
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0;
    overflow: hidden;
    border: none;
}

/* Sublist */
.ep-toc-sublist {
    margin: 0 !important;
    padding: 0 0 0 12px !important;
    counter-reset: toc-h3;
}
.ep-toc-sublist .ep-toc-sublist {
    counter-reset: toc-h4;
}

/* Items */
.ep-toc-list li {
    margin: 0 !important;
    padding: 0 !important;
}
.ep-toc-list > li {
    counter-increment: toc-h2;
}
.ep-toc-sublist > li {
    counter-increment: toc-h3;
}
.ep-toc-sublist .ep-toc-sublist > li {
    counter-increment: toc-h4;
}

/* Links */
.ep-toc-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    font-size: 0.95rem;
    color: #333;
    text-decoration: none !important;
    transition: all 0.2s ease;
    line-height: 1.4;
    border-bottom: none !important;
}

/* H2 numbering */
.ep-toc-list > li > .ep-toc-link::before {
    content: counter(toc-h2) ".";
    color: #c5a47e;
    font-weight: 700;
    font-size: 0.88rem;
    min-width: 24px;
    flex-shrink: 0;
}

/* H3 numbering */
.ep-toc-sublist > li > .ep-toc-link::before {
    content: counter(toc-h2) "." counter(toc-h3);
    color: #d4bf9a;
    font-weight: 700;
    font-size: 0.84rem;
    min-width: 28px;
    flex-shrink: 0;
}

/* H4 numbering */
.ep-toc-sublist .ep-toc-sublist > li > .ep-toc-link::before {
    content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4);
    color: #999;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 34px;
    flex-shrink: 0;
}

.ep-toc-link:hover {
    background: rgba(197, 164, 126, 0.08);
    color: #8b6914;
    padding-left: 16px;
}
.ep-toc-link.is-active {
    background: rgba(197, 164, 126, 0.1);
    color: #8b6914;
    font-weight: 600;
    border-left: 3px solid #c5a47e;
    margin-left: -3px;
}

/* Indentation */
.toc-level-2 > .ep-toc-link {
    padding-left: 12px;
}
.toc-level-3 > .ep-toc-link {
    padding-left: 32px;
    font-size: 0.9rem;
}
.toc-level-4 > .ep-toc-link {
    padding-left: 52px;
    font-size: 0.84rem;
    color: #555;
}

/* Scrollbar */
.ep-toc-list::-webkit-scrollbar {
    width: 4px;
}
.ep-toc-list::-webkit-scrollbar-track {
    background: transparent;
}
.ep-toc-list::-webkit-scrollbar-thumb {
    background: rgba(197, 164, 126, 0.3);
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .ep-toc {
        margin: 0 0 24px;
        width: 100%;
        max-width: 100%;
    }
    .ep-toc.is-collapsed {
        max-width: 140px;
    }
    .ep-toc.is-collapsed .ep-toc-header {
        padding: 5px 10px;
        justify-content: center;
    }
    .ep-toc.is-collapsed .ep-toc-title {
        flex: none;
        text-align: center;
    }
    .ep-toc.is-collapsed .ep-toc-count {
        display: none;
    }
    .ep-toc-list {
        padding: 0 10px 10px 10px;
        max-height: 400px;
    }
    .ep-toc-link {
        padding: 4px 6px;
        font-size: 0.85rem;
        gap: 6px;
    }
    .toc-level-2 > .ep-toc-link {
        padding-left: 6px;
    }
    .toc-level-3 > .ep-toc-link {
        padding-left: 16px;
        font-size: 0.82rem;
    }
    .toc-level-4 > .ep-toc-link {
        padding-left: 26px;
        font-size: 0.78rem;
    }
}
