/* فهرست مطالب — مودال فروشگاه (سبک فهرست کتاب) */

.btn--toc {
    background: linear-gradient(135deg, #1c1917 0%, #292524 55%, #3f3f46 100%);
    border: 1px solid rgba(251, 191, 36, 0.28);
    color: #fafaf9;
    box-shadow: 0 12px 28px rgba(28, 25, 23, 0.35);
}

.btn--toc:hover {
    transform: translateY(-1px);
    border-color: rgba(251, 191, 36, 0.45);
}

.btn--toc__icon {
    margin-left: 0.35rem;
}

.book-toc-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 10, 9, 0.72);
    backdrop-filter: blur(8px);
    z-index: 1200;
}

.book-toc-backdrop[hidden],
.book-toc-modal[hidden] {
    display: none !important;
}

.book-toc-modal {
    position: fixed;
    inset: 0;
    z-index: 1210;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.book-toc-modal__panel {
    width: min(640px, 100%);
    max-height: min(88vh, 920px);
    display: flex;
    flex-direction: column;
    border-radius: 4px 18px 18px 4px;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(120, 53, 15, 0.55) 0 10px, transparent 10px),
        linear-gradient(180deg, #faf7f2 0%, #f3ebe0 48%, #efe4d6 100%);
    border: 1px solid rgba(68, 64, 60, 0.18);
    box-shadow:
        0 30px 80px rgba(28, 25, 23, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
    color: #1c1917;
    animation: bookTocIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes bookTocIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.book-toc-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem 1rem 1.55rem;
    border-bottom: 1px solid rgba(120, 113, 108, 0.22);
    background:
        radial-gradient(ellipse at top left, rgba(180, 83, 9, 0.08), transparent 55%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent);
}

.book-toc-modal__eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: #b45309;
}

.book-toc-modal__head h2 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.45;
    font-family: "Vazirmatn", Georgia, "Times New Roman", serif;
    font-weight: 800;
    color: #1c1917;
}

.book-toc-modal__meta {
    margin: 0.4rem 0 0;
    font-size: 0.78rem;
    color: #78716c;
}

.book-toc-modal__close {
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid rgba(120, 113, 108, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    color: #44403c;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.book-toc-modal__close:hover {
    background: #fff;
    transform: scale(1.04);
}

.book-toc-modal__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.65rem 1.35rem 0.2rem 1.55rem;
}

.book-toc-tool {
    border: 1px solid rgba(120, 113, 108, 0.25);
    background: rgba(255, 255, 255, 0.55);
    color: #44403c;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
}

.book-toc-tool:hover {
    background: #fff;
    border-color: rgba(180, 83, 9, 0.35);
    color: #9a3412;
}

.book-toc-modal__body {
    overflow: auto;
    padding: 0.55rem 1.2rem 1.4rem 1.45rem;
}

.book-toc-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.book-toc-tree .book-toc-tree {
    margin: 0.15rem 0 0.35rem;
    padding-right: 0.85rem;
    border-right: 1px dashed rgba(180, 83, 9, 0.28);
}

.book-toc-node {
    margin: 0;
}

.book-toc-node.is-collapsed > .book-toc-tree {
    display: none;
}

.book-toc-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.35rem 0.45rem;
    padding: 0.42rem 0.15rem;
    border-radius: 8px;
    transition: background 0.15s;
}

.book-toc-row:hover {
    background: rgba(180, 83, 9, 0.06);
}

.book-toc-toggle {
    width: 1.55rem;
    height: 1.55rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #a8a29e;
    font-size: 0.7rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.book-toc-toggle:hover {
    background: rgba(180, 83, 9, 0.12);
    color: #9a3412;
}

.book-toc-toggle.is-leaf {
    visibility: hidden;
    pointer-events: none;
}

.book-toc-main {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 0.45rem;
}

.book-toc-label {
    font-size: 0.68rem;
    font-weight: 800;
    color: #9a3412;
    white-space: nowrap;
}

.book-toc-title {
    min-width: 0;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.55;
    color: #1c1917;
    font-family: "Vazirmatn", Georgia, "Times New Roman", serif;
}

.book-toc-leader {
    display: flex;
    align-items: flex-end;
    min-width: 2.5rem;
    height: 1.1rem;
    margin: 0 0.15rem;
    border-bottom: 1px dotted rgba(120, 113, 108, 0.55);
    opacity: 0.85;
}

.book-toc-pages {
    font-size: 0.78rem;
    font-weight: 800;
    color: #57534e;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    letter-spacing: 0.02em;
    min-width: 2.8rem;
    text-align: left;
}

.book-toc-node--depth-0 > .book-toc-row .book-toc-title {
    font-size: 1rem;
    font-weight: 800;
}

.book-toc-node--depth-0 > .book-toc-row {
    margin-top: 0.35rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(168, 162, 158, 0.25);
}

.book-toc-node--depth-0:first-child > .book-toc-row {
    border-top: none;
    margin-top: 0;
}

@media (max-width: 640px) {
    .book-toc-modal__panel {
        border-radius: 14px;
        max-height: 92vh;
    }

    .book-toc-main {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }

    .book-toc-leader {
        display: none;
    }

    .book-toc-pages {
        text-align: right;
    }
}
