/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #fafafa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


/* Header */
.header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.book-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.reading-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-counter {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.progress-bar {
    width: 150px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: white;
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Main Container */
.main-container {
    display: flex;
    min-height: calc(100vh - 80px);
    margin-top: 80px;
}

/* Table of Contents Sidebar */
.toc-sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    position: fixed;
    left: 0;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 50;
}

.toc-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toc-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.toc-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

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

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

.toc-list a {
    display: block;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: #555;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.toc-list a:hover {
    background: #f0f4ff;
    color: #1e40af;
    border-left-color: #1e40af;
}

.toc-list a.active {
    background: #e0f2fe;
    color: #1e40af;
    border-left-color: #1e40af;
    font-weight: 500;
}

/* Reading Content */
.reading-content {
    flex: 1;
    margin-left: 300px;
    background: white;
    min-height: calc(100vh - 80px);
}

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

/* Book Content */
.book-content {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #333;
}

.book-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 2rem;
    line-height: 1.2;
}

.book-content h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 3rem 0 1.5rem 0;
    line-height: 1.3;
}

.book-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #34495e;
    margin: 2.5rem 0 1rem 0;
    line-height: 1.3;
}

.book-content h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #34495e;
    margin: 2rem 0 1rem 0;
    line-height: 1.3;
}

.book-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.book-content ul, .book-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

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

.book-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.book-content em {
    font-style: italic;
    color: #555;
}

/* Quote/Highlight Blocks */
.book-content blockquote {
    border-left: 4px solid #1e40af;
    background: #f0f4ff;
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    border-radius: 0 4px 4px 0;
}

/* Chapter Dividers */
.chapter-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
    margin: 4rem 0;
}

/* Menu Toggle Button */
.menu-toggle {
    display: none;
    position: fixed;
    top: 90px;
    left: 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 60;
    flex-direction: column;
    gap: 3px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
}

.menu-toggle span {
    width: 18px;
    height: 2px;
    background: #333;
    border-radius: 1px;
    transition: all 0.3s ease;
}

/* Navigation Controls */
.nav-controls {
    position: fixed;
    bottom: 47px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 40;
}

.nav-btn {
    background: #1e40af;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.3);
}

.nav-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.4);
}

.nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .book-title {
        font-size: 1rem;
    }
    
    .reading-progress {
        gap: 0.5rem;
    }
    
    .page-counter {
        font-size: 0.75rem;
    }
    
    .progress-bar {
        width: 100px;
    }
    
    .toc-sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .toc-sidebar.active {
        transform: translateX(0);
    }
    
    .toc-toggle {
        display: block;
    }
    
    .reading-content {
        margin-left: 0;
    }
    
    .content-wrapper {
        padding: 2rem 1rem;
    }
    
    .book-content h1 {
        font-size: 2rem;
    }
    
    .book-content h2 {
        font-size: 1.7rem;
    }
    
    .book-content h3 {
        font-size: 1.3rem;
    }
    
    .book-content {
        font-size: 1rem;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .nav-controls {
        bottom: 1rem;
        gap: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .book-title {
        font-size: 0.9rem;
    }
    
    .page-counter {
        font-size: 0.7rem;
    }
    
    .progress-bar {
        width: 80px;
    }
    
    .toc-sidebar {
        width: 250px;
    }
    
    .content-wrapper {
        padding: 2.5rem 0.5rem;
    }
    
    .book-content h1 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    .book-content h2 {
        font-size: 1.5rem;
        margin: 2rem 0 1rem 0;
    }
    
    .book-content {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection colors */
::selection {
    background: #1e40af;
    color: white;
}

::-moz-selection {
    background: #1e40af;
    color: white;
}
