/* Exact Sidebar Design from Screenshot */

/* Sidebar Header */
.sidebar-header-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Hide the sidebar close button */
.sidebar-header-new #closeSidebar {
    display: none !important;
}

.sidebar-main-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

[data-theme="dark"] .sidebar-main-title {
    color: #dde6ed;
}

.sidebar-collapse-btn {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background-color: #f6416c;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-collapse-btn:hover {
    background-color: #e03a61;
}

[data-theme="dark"] .sidebar-collapse-btn {
    background-color: #ffb33f;
}

[data-theme="dark"] .sidebar-collapse-btn:hover {
    background-color: #f5a832;
}

/* Sidebar Sections */
.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 0.5rem;
    display: block;
}

/* Book Selector */
.sidebar-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #111827;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-select:focus {
    outline: none;
    border-color: #f6416c;
    box-shadow: 0 0 0 3px rgba(246, 65, 108, 0.1);
}

[data-theme="dark"] .sidebar-select {
    background-color: #2b3d54;
    border-color: #3f556d;
    color: #dde6ed;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: #9ca3af;
    font-size: 0.875rem;
}

.search-input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 2.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #111827;
    background-color: white;
    transition: all 0.2s;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-input:focus {
    outline: none;
    border-color: #f6416c;
    box-shadow: 0 0 0 3px rgba(246, 65, 108, 0.1);
}

.search-clear {
    position: absolute;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
}

.search-clear:hover {
    background-color: #f3f4f6;
    color: #111827;
}

[data-theme="dark"] .search-input {
    background-color: #2b3d54;
    border-color: #3f556d;
    color: #dde6ed;
}

[data-theme="dark"] .search-clear:hover {
    background-color: #3f556d;
    color: #dde6ed;
}

/* Search Results */
#searchResults {
    font-size: 0.8125rem;
    color: #6b7280;
}

.search-summary {
    padding: 0.75rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

[data-theme="dark"] .search-summary {
    background-color: #2b3d54;
    border-color: #3f556d;
    color: #c6d2db;
}

.search-count {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #111827;
}

[data-theme="dark"] .search-count {
    color: #dde6ed;
}

.search-navigation {
    display: flex;
    gap: 0.5rem;
}

.search-navigation button {
    flex: 1;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #e5e7eb;
    background-color: white;
    color: #6b7280;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.search-navigation button:hover {
    background-color: #f9fafb;
    border-color: #f6416c;
    color: #f6416c;
}

[data-theme="dark"] .search-navigation button {
    background-color: #2b3d54;
    border-color: #3f556d;
    color: #c6d2db;
}

[data-theme="dark"] .search-navigation button:hover {
    background-color: #32465c;
    border-color: #ffb33f;
    color: #ffb33f;
}

/* TOC Header */
.toc-header-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.toc-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-badge-new {
    background-color: #f8f3d4;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    min-width: 2rem;
    text-align: center;
}

[data-theme="dark"] .toc-badge-new {
    background-color: #526d82;
    color: #c6d2db;
}

.toc-collapse-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.toc-collapse-btn:hover {
    background-color: #f3f4f6;
    color: #111827;
}

[data-theme="dark"] .toc-collapse-btn:hover {
    background-color: #3f556d;
    color: #dde6ed;
}

/* TOC List */
.toc-list-new {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem 0;
    max-height: 300px;
    overflow-y: auto;
}

.toc-list-new::-webkit-scrollbar {
    width: 4px;
}

.toc-list-new::-webkit-scrollbar-track {
    background: transparent;
}

.toc-list-new::-webkit-scrollbar-thumb {
    background-color: #e5e7eb;
    border-radius: 2px;
}

.toc-list-new::-webkit-scrollbar-thumb:hover {
    background-color: #d1d5db;
}

.toc-item-new {
    font-size: 0.8125rem;
    color: #6b7280;
    padding: 0.5rem 0;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1.4;
}

.toc-item-new:hover {
    color: #f6416c;
}

.toc-item-new.active {
    color: #f6416c;
    font-weight: 600;
}

.toc-item-new.indent-1 {
    padding-left: 1rem;
    font-size: 0.75rem;
}

[data-theme="dark"] .toc-item-new {
    color: #c6d2db;
}

[data-theme="dark"] .toc-item-new:hover,
[data-theme="dark"] .toc-item-new.active {
    color: #ffb33f;
    font-weight: 600;
}

/* Mobile responsive sidebar */
@media (max-width: 768px) {
    .sidebar-header-new {
        margin-bottom: 1rem;
    }
    
    .sidebar-main-title {
        font-size: 0.9rem;
    }
    
    .sidebar-section {
        margin-bottom: 1.25rem;
    }
    
    .sidebar-label {
        font-size: 0.65rem;
    }
    
    .sidebar-select {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
    }
    
    .search-input {
        padding: 0.5rem 2.25rem 0.5rem 2rem;
        font-size: 0.8125rem;
    }
    
    .toc-list-new {
        max-height: 250px;
    }
    
    .toc-item-new {
        font-size: 0.78rem;
        padding: 0.4rem 0;
        line-height: 1.35;
    }
    
    .toc-badge-new {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* View Comments Button */
.view-comments-btn {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: white;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.view-comments-btn:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

[data-theme="dark"] .view-comments-btn {
    background-color: #2b3d54;
    border-color: #3f556d;
    color: #c6d2db;
}

[data-theme="dark"] .view-comments-btn:hover {
    background-color: #32465c;
    color: #dde6ed;
}

/* Reading Stats */
.stats-simple {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.6;
}

.stat-line {
    margin-bottom: 0.25rem;
}

.stat-line span {
    font-weight: 600;
    color: #111827;
}

[data-theme="dark"] .stats-simple {
    color: #c6d2db;
}

[data-theme="dark"] .stat-line span {
    color: #dde6ed;
}

/* Download Section */
.download-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.75rem;
}

[data-theme="dark"] .download-title {
    color: #dde6ed;
}

.download-buttons-new {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.download-btn-new {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.download-pdf {
    color: #dc2626;
    border-color: #dc2626;
    background-color: white;
}

.download-pdf:hover {
    background-color: #fef2f2;
}

.download-epub {
    color: #9333ea;
    border-color: #9333ea;
    background-color: white;
}

.download-epub:hover {
    background-color: #faf5ff;
}

[data-theme="dark"] .download-pdf,
[data-theme="dark"] .download-epub {
    background-color: #2b3d54;
}

[data-theme="dark"] .download-pdf:hover {
    background-color: #32465c;
}

[data-theme="dark"] .download-epub:hover {
    background-color: #32465c;
}

/* Override old sidebar styles */
.book-sidebar {
    background-color: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 1rem !important;
    padding: 1.5rem !important;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1) !important;
    transition: transform 0.3s ease, opacity 0.3s ease !important;
}

[data-theme="dark"] .book-sidebar {
    background-color: #32465c !important;
    border-color: #3f556d !important;
}

/* Collapsed sidebar */
.book-sidebar.collapsed {
    transform: translateX(-100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Expand main content when sidebar is collapsed - using body class */
body.sidebar-collapsed .book-main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

body.sidebar-collapsed .book-reader-layout {
    grid-template-columns: 0 1fr !important;
}

