/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Georgia, serif;
    line-height: 1.6;
    color: #333;
    overflow: hidden;
    height: 100vh;
    background: linear-gradient(135deg, #e8f4f8 0%, #f0f8f4 50%, #faf6f2 100%);
}

/* Book viewer layout */
.book-viewer {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Table of Contents sidebar */
.toc-sidebar {
    width: 320px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    flex-shrink: 0;
}

.toc-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #4A9B9B 0%, #5EAAA8 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.toc-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.toc-header p {
    font-size: 0.9rem;
    opacity: 0.9;
}

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

.toc-list li {
    border-bottom: 1px solid #e9ecef;
}

.toc-list a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s;
}

.toc-list a:hover {
    background: #e9ecef;
    color: #4A9B9B;
    padding-left: 2rem;
}

.toc-list a.active {
    background: #e8f5f4;
    color: #4A9B9B;
    border-left: 4px solid #4A9B9B;
    font-weight: bold;
}

.download-section {
    padding: 1.5rem;
    border-top: 2px solid #dee2e6;
    background: #fff;
}

.download-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #495057;
}

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

.download-links a {
    padding: 0.5rem 1rem;
    background: #4A9B9B;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    transition: background 0.2s;
}

.download-links a:hover {
    background: #3d8282;
}

/* Chapter viewer */
.chapter-viewer {
    flex: 1;
    overflow-y: auto;
    background: white;
}

.chapter-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.chapter-content h1 {
    margin-bottom: 1.5rem;
    color: #4A9B9B;
}

.chapter-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #495057;
}

.chapter-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #6c757d;
}

.chapter-content p {
    margin-bottom: 1rem;
}

.chapter-content ul, .chapter-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.chapter-content li {
    margin-bottom: 0.5rem;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

/* Mobile toggle button */
.mobile-toggle {
    display: none;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: #4A9B9B;
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.mobile-toggle:hover {
    background: #3d8282;
}

/* Responsive design */
@media (max-width: 768px) {
    .toc-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 999;
        transition: left 0.3s;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .toc-sidebar.open {
        left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .chapter-content {
        padding: 1rem;
    }
}

/* Chapter navigation for individual chapter pages */
.chapter-nav {
    margin: 2em 0;
    padding: 1em;
    background: #f5f5f5;
    text-align: center;
    border-radius: 4px;
}

.chapter-nav a {
    margin: 0 1em;
    text-decoration: none;
    color: #4A9B9B;
}

.chapter-nav a:hover {
    text-decoration: underline;
}
