/**
 * Universal Book Detail Page Styles
 * Auto-adapts to: Complex, Torah, Simple, Standard chapter layouts
 */

.sefaria-book-detail {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.book-content {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 60px;
}

@media (max-width: 1024px) {
    .book-content {
        grid-template-columns: 1fr;
    }
}

/* Book Header */
.book-header {
    margin-bottom: 30px;
}

.book-header h1 {
    font-size: 36px;
    font-weight: 400;
    margin: 0 0 8px 0;
    color: #333;
}

.book-category {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #999;
    margin: 0 0 20px 0;
}

.btn-start-reading {
    display: inline-block;
    padding: 12px 24px;
    background: #1E3A5F;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-start-reading:hover {
    background: #152940;
}

/* Tabs */
.book-tabs {
    display: flex;
    gap: 30px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 30px;
}

.tab-link {
    padding: 12px 0;
    color: #666;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-link:hover {
    color: #333;
}

.tab-link.active {
    color: #333;
    border-bottom-color: #1E3A5F;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Content Sections */
.content-section {
    margin-bottom: 40px;
}

.content-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #333;
}

.section-subtitle {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #666;
    margin: 0 0 16px 0;
}

/* Complex Structure (Siddur-style) */
.section-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.section-list li {
    margin-bottom: 8px;
}

.section-list a {
    color: #333;
    text-decoration: none;
    font-size: 15px;
    display: block;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.section-list a:hover {
    color: #0066cc;
}

/* Chapter Grid (Genesis-style, Duties-style) */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 12px;
    max-width: 600px;
}

.chapter-num {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.chapter-num:hover {
    background: #e8e8e8;
    color: #0066cc;
}

/* Simple Chapters (Habakkuk-style) */
.simple-chapters {
    display: flex;
    gap: 16px;
}

.simple-chapter {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.simple-chapter:hover {
    background: #e8e8e8;
    color: #0066cc;
}

/* Torah Portions Grid */
.portions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 600px;
}

.portion-item a {
    display: block;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.portion-item a:hover {
    border-color: #0066cc;
    color: #0066cc;
}

/* Sidebar */
.book-sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
}

.sidebar-section {
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid #e8e8e8;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #333;
}

.sidebar-section p {
    font-size: 14px;
    line-height: 1.7;
    color: #666;
    margin: 0;
}

/* Download Section */
.download-select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    background: #fff;
    cursor: pointer;
}

.download-btn {
    width: 100%;
    padding: 12px;
    background: #f5f5f5;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    color: #999;
    cursor: not-allowed;
}

.download-btn:not(:disabled) {
    background: #1E3A5F;
    color: #fff;
    cursor: pointer;
}

.download-btn:not(:disabled):hover {
    background: #152940;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .book-header h1 {
        font-size: 28px;
    }
    
    .chapter-grid {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
        gap: 8px;
    }
    
    .portions-grid {
        grid-template-columns: 1fr;
    }
}

