/* ============================================
   CHAPTERS SIDEBAR - Left Navigation (layout only;
   surface styling lives in glassmorphism.css)
   ============================================ */

#chapters-sidebar {
    width: var(--chapters-w, 288px);
    min-width: 0;          /* let the flex item actually collapse */
    color: var(--ui-text, #ececf1);
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

#chapters-sidebar.collapsed {
    width: 0;
    border: none;
}

.chapters-content {
    padding: 60px 18px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: var(--chapters-w, 288px);
    opacity: 1;
    transition: opacity 0.2s ease;
}

#chapters-sidebar.collapsed .chapters-content {
    opacity: 0;
    pointer-events: none;
}

/* Book Metadata */
.book-metadata {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 12px;
    border-radius: 12px;
}

.book-cover-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

#book-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ui-text, #ececf1);
    text-align: center;
    margin: 0;
    line-height: 1.35;
}

#book-author {
    font-size: 12.5px;
    color: var(--ui-text-secondary, #c2c2cc);
    text-align: center;
    margin: 0;
}

/* Upload Section */
.upload-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-btn {
    width: 100%;
    padding: 11px 16px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    min-height: 44px;
}

/* Chapters List */
.chapters-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.chapter-item {
    padding: 11px 12px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
}

.chapter-number {
    font-size: 12px;
    color: var(--ui-accent, #60a5fa);
    font-weight: 700;
    flex-shrink: 0;
    min-width: 22px;
    font-variant-numeric: tabular-nums;
}

.chapter-title {
    font-size: 13px;
    color: var(--ui-text, #ececf1);
    line-height: 1.4;
    flex: 1;
    word-wrap: break-word;
}

.chapter-item.active .chapter-title {
    font-weight: 700;
}

.chapters-list-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--ui-text-muted, #9a9aa6);
    font-size: 13px;
}

.chapters-list::-webkit-scrollbar { width: 6px; }
.chapters-list::-webkit-scrollbar-track { background: transparent; }
