/* Book-Themed Stylesheet - Parchment/Paper Aesthetic */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(to bottom, #f4e8d0 0%, #e8dcc0 100%);
    background-attachment: fixed;
    color: #3d2817;
    line-height: 1.6;
    min-height: 100vh;
}

/* Container for TOC page */
.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Left sidebar - Chapter list */
.sidebar-left {
    width: 250px;
    background: #d4c4a8;
    border-right: 3px solid #8b7355;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
}

.sidebar-left h2 {
    color: #5d4037;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
    border-bottom: 2px solid #8b7355;
    padding-bottom: 10px;
}

.sidebar-left h3 {
    color: #5d4037;
    margin: 20px 0 15px 0;
    font-size: 1.2em;
    border-bottom: 1px solid #8b7355;
    padding-bottom: 8px;
}

.toc-list {
    list-style: none;
    margin-bottom: 20px;
}

.toc-list li {
    margin-bottom: 10px;
}

.toc-link {
    display: block;
    padding: 12px 15px;
    background: #8b7355;
    color: #f4e8d0;
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid #6b5b4a;
    transition: all 0.3s ease;
    font-weight: 600;
}

.toc-link:hover {
    background: #5d4037;
    border-color: #4a3a2a;
    transform: translateX(5px);
}

.toc-link.active {
    background: #4a3a2a;
    color: #f4e8d0;
}

.chapter-list {
    list-style: none;
}

.chapter-list li {
    margin-bottom: 10px;
}

.chapter-list a {
    display: block;
    padding: 10px 15px;
    background: #e8dcc0;
    color: #5d4037;
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid #c4b59a;
    transition: all 0.3s ease;
}

.chapter-list a:hover {
    background: #d4c4a8;
    border-color: #8b7355;
    transform: translateX(5px);
}

.chapter-list a.active {
    background: #8b7355;
    color: #f4e8d0;
    font-weight: bold;
}

/* Main content area */
.main-content {
    flex: 1;
    padding: 20px;
    overflow: hidden;
    min-width: 0;
}

.content-section {
    background: #faf8f3;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid #d4c4a8;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.content-section > h2 {
    padding: 25px 25px 15px 25px;
    margin: 0;
    color: #5d4037;
    font-size: 1.8em;
    border-bottom: 2px solid #8b7355;
    flex-shrink: 0;
}

.content-section > p {
    padding: 25px;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.content-section > div {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.chapter-content-embedded {
    padding: 0 25px 25px 25px;
}

.chapter-content-embedded p {
    margin-bottom: 20px;
    text-align: justify;
    font-size: 1.05em;
    line-height: 1.8;
}

.character-list-content {
    padding: 0 25px 25px 25px;
}

/* Iframe styling */
#chapter-iframe {
    display: block;
    width: 100%;
    min-height: 400px;
    border: none;
}

/* Character popup */
.character-popup {
    position: fixed;
    background: #faf8f3;
    border: 3px solid #8b7355;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
}

.character-popup iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #faf8f3;
}

.character-item {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #d4c4a8;
}

.character-item:last-child {
    border-bottom: none;
}

.character-item h3 {
    color: #8b7355;
    margin-bottom: 8px;
    font-size: 1.3em;
}

.character-item h3 a {
    color: #8b7355;
    text-decoration: none;
}

.character-item h3 a:hover {
    color: #5d4037;
    text-decoration: underline;
}

.character-item p {
    color: #3d2817;
    line-height: 1.7;
}

/* Chapter page styles */
.chapter-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    background: #faf8f3;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    min-height: 100vh;
}

/* When chapter page is in iframe */
iframe .chapter-page {
    max-width: 100%;
    padding: 20px;
    box-shadow: none;
    min-height: auto;
}

.chapter-page h1 {
    color: #5d4037;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-align: center;
    border-bottom: 3px solid #8b7355;
    padding-bottom: 20px;
}

.chapter-content {
    font-size: 1.1em;
    line-height: 1.9;
    text-align: justify;
    margin-bottom: 40px;
}

.chapter-content p {
    margin-bottom: 20px;
}

/* Character name links */
.character-link {
    color: #8b7355;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted #8b7355;
}

/* Navigation */
.navigation {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #d4c4a8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-link {
    display: inline-block;
    padding: 12px 25px;
    background: #8b7355;
    color: #f4e8d0;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.nav-link:hover {
    background: #5d4037;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.nav-link.toc {
    background: #6b5b4a;
}

/* Character list page */
.characters-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    background: #faf8f3;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    min-height: 100vh;
}

.characters-page h1 {
    color: #5d4037;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-align: center;
    border-bottom: 3px solid #8b7355;
    padding-bottom: 20px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #d4c4a8;
}

::-webkit-scrollbar-thumb {
    background: #8b7355;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5d4037;
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .sidebar-left,
    .navigation {
        display: none;
    }
    
    .chapter-page,
    .characters-page {
        box-shadow: none;
        padding: 20px;
    }
}

