/* ===== BRAIN GAMES BOOK VIEW ===== */
/* Google Primary Colors Theme */

#book-container {
    height: 100%;
    overflow: hidden;
    background: #ffffff;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.book-view {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.book-view.active {
    display: flex;
}

/* --- Book Spread Container --- */
.book-spread {
    flex: 1;
    width: 100%;
    max-width: 900px;
    max-height: 650px;
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-height: 0;
}

/* Spine shadow */
.book-spine {
    position: absolute;
    left: 50%;
    top: 5%;
    bottom: 5%;
    width: 4px;
    transform: translateX(-50%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0,0,0,0.1) 30%,
        rgba(0,0,0,0.15),
        rgba(0,0,0,0.1) 70%,
        transparent
    );
    z-index: 5;
    pointer-events: none;
}

/* --- Pages --- */
.book-page-left,
.book-page-right {
    flex: 1;
    background: #ffffff;
    border: 2px solid #e8eaed;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    cursor: pointer;
}

.book-page-left {
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.book-page-right {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.book-page-content {
    flex: 1;
    padding: 30px 35px 20px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #dadce0 transparent;
    min-height: 0;
    font-family: 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #202124;
}

.book-page-content::-webkit-scrollbar { width: 6px; }
.book-page-content::-webkit-scrollbar-track { background: transparent; }
.book-page-content::-webkit-scrollbar-thumb { 
    background: #dadce0; 
    border-radius: 3px;
}
.book-page-content::-webkit-scrollbar-thumb:hover { background: #bdc1c6; }

/* --- Cover Page --- */
#book-cover {
    background: linear-gradient(135deg, #4285f4 0%, #1967d2 100%);
}

.cover-title {
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.cover-subtitle {
    font-size: 1.3rem;
    color: rgba(255,255,255,0.9);
    text-align: center;
    margin-bottom: 3rem;
    font-weight: 300;
}

.book-action-btn {
    background: #ffffff;
    color: #1967d2;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.book-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* --- Chapter Navigation (removed from pages) --- */
.chapter-nav {
    display: none !important;
}

/* --- Chapter Bottom Menu --- */
.chapter-bottom-menu {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.chapter-menu-toggle {
    background: #4285f4;
    color: #ffffff;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.chapter-menu-toggle:hover {
    background: #1967d2;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.chapter-dropdown {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 2px solid #4285f4;
    border-radius: 12px;
    padding: 12px 0;
    min-width: 300px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: none;
}

.chapter-dropdown.active {
    display: block;
}

.chapter-dropdown-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 0.95rem;
    color: #202124;
    border-left: 4px solid transparent;
}

.chapter-dropdown-item:hover {
    background: #f8f9fa;
    border-left-color: #4285f4;
}

.chapter-dropdown-item.active {
    background: #e8f0fe;
    border-left-color: #1967d2;
    font-weight: 600;
    color: #1967d2;
}

.chapter-dropdown-item strong {
    color: #1967d2;
    font-weight: 600;
}

/* --- Typography --- */
.chapter-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #4285f4;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.chapter-number {
    font-size: 0.9rem;
    color: #5f6368;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    display: block;
}

.chapter-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #ea4335;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.chapter-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #34a853;
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
}

.chapter-content p {
    margin-bottom: 1rem;
    color: #202124;
}

.chapter-content em {
    color: #1967d2;
    font-style: italic;
    font-weight: 500;
}

.chapter-content strong {
    color: #202124;
    font-weight: 600;
}

/* Lists styling */
.chapter-content ul {
    margin: 1rem 0 1.5rem 0;
    padding-left: 1.5rem;
}

.chapter-content ul li {
    margin-bottom: 0.6rem;
    line-height: 1.6;
    color: #202124;
}

.chapter-content ul li::marker {
    color: #4285f4;
}

/* --- Insight Boxes --- */
.insight-box {
    background: #fef7e0;
    border-left: 4px solid #fbbc04;
    padding: 16px 20px;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.insight-box strong {
    color: #ea4335;
    font-weight: 600;
}

/* --- Table of Contents --- */
#book-toc {
    padding: 40px;
    overflow-y: auto;
}

.toc-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #4285f4;
    text-align: center;
    margin-bottom: 2rem;
}

.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.toc-item {
    background: #ffffff;
    border: 2px solid #e8eaed;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.toc-item:hover {
    border-color: #4285f4;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.15);
    transform: translateY(-2px);
}

.toc-number {
    font-size: 1.1rem;
    color: #5f6368;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 25px;
}

.toc-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toc-title-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #202124;
    line-height: 1.3;
}

.toc-subtitle {
    font-size: 0.9rem;
    color: #5f6368;
    font-weight: 400;
    line-height: 1.2;
    font-style: italic;
}

.toc-item-number {
    font-size: 0.85rem;
    color: #5f6368;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.toc-item-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #202124;
    line-height: 1.3;
}

/* Page Numbers */
.page-number {
    position: absolute;
    bottom: 15px;
    font-size: 0.85rem;
    color: #5f6368;
    font-weight: 500;
}

.book-page-left .page-number {
    left: 25px;
}

.book-page-right .page-number {
    right: 25px;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .book-spread {
        max-width: 95%;
    }
    
    .cover-title {
        font-size: 2.5rem;
    }
    
    .cover-subtitle {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .book-spread {
        flex-direction: column;
    }
    
    .book-page-left,
    .book-page-right {
        border-radius: 8px;
        border: 2px solid #e8eaed;
        margin-bottom: 10px;
    }
    
    .book-spine {
        display: none;
    }
    
    .toc-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 580px) {
    #book-container {
        padding: 10px;
    }
    
    .book-page-content {
        padding: 20px;
        font-size: 15px;
    }
    
    .cover-title {
        font-size: 2rem;
    }
    
    .cover-subtitle {
        font-size: 1rem;
    }
    
    .chapter-title {
        font-size: 1.8rem;
    }
    
    .toc-title {
        font-size: 2rem;
    }
    
    .chapter-menu-toggle {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .chapter-dropdown {
        min-width: 250px;
    }
}