/* ==========================================================================
   Book Layout Styles — OKR in der Verwaltung
   Scoped to .book-* classes, does not affect rest of site.
   ========================================================================== */

/* --- CSS Variables --- */
:root {
    --book-accent: #2a5998;
    --book-accent-light: #e8eef7;
    --book-text: #2c3e50;
    --book-text-light: #6c757d;
    --book-border: #e2e8f0;
    --book-bg-sidebar: #f8f9fc;
    --book-content-max-width: 700px;
    --book-font-size: 18px;
    --book-line-height: 1.75;
}

/* --- Reading Progress Bar --- */
.book-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--book-accent);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* --- Book Page Section --- */
.book-page {
    padding-top: 30px;
    padding-bottom: 60px;
}

/* --- Breadcrumb --- */
.book-breadcrumb {
    padding: 0 0 20px 0;
    font-size: 14px;
    color: var(--book-text-light);
}

.book-breadcrumb a {
    color: var(--book-accent);
    text-decoration: none;
}

.book-breadcrumb a:hover {
    text-decoration: underline;
}

.book-breadcrumb .separator {
    margin: 0 6px;
    color: #ccc;
}

/* --- Book Start Page (TOC) --- */
.book-hero {
    text-align: center;
    padding: 40px 0 30px;
    border-bottom: 2px solid var(--book-border);
    margin-bottom: 40px;
}

.book-cover-image {
    display: block;
    max-width: 320px;
    height: auto;
    margin: 0 auto 24px;
}

.book-hero h1 {
    font-size: 2.4em;
    font-weight: 700;
    color: var(--book-text);
    margin-bottom: 10px;
}

.book-hero .book-description {
    font-size: 1.15em;
    color: var(--book-text-light);
    max-width: 600px;
    margin: 0 auto;
}

.book-toc-heading {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--book-text-light);
    margin-bottom: 30px;
    font-weight: 600;
}

/* Chapter block on book start page */
.book-toc-chapter {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--book-border);
}

.book-toc-chapter:last-child {
    border-bottom: none;
}

.book-toc-chapter-title {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--book-accent);
    font-weight: 600;
    margin-bottom: 4px;
}

.book-toc-chapter-name {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 16px;
}

.book-toc-chapter-name a {
    color: var(--book-text);
    text-decoration: none;
}

.book-toc-chapter-name a:hover {
    color: var(--book-accent);
}

/* Section within chapter TOC */
.book-toc-section {
    margin-bottom: 14px;
    padding-left: 8px;
}

.book-toc-section-title {
    font-size: 1.05em;
    font-weight: 600;
    margin-bottom: 6px;
}

.book-toc-section-title a {
    color: var(--book-text);
    text-decoration: none;
}

.book-toc-section-title a:hover {
    color: var(--book-accent);
}

.book-toc-pages {
    list-style: none;
    padding: 0;
    margin: 0 0 0 4px;
    border-left: 2px solid var(--book-border);
}

.book-toc-pages li {
    padding: 3px 0 3px 14px;
}

.book-toc-pages li a {
    color: var(--book-text-light);
    text-decoration: none;
    font-size: 0.95em;
}

.book-toc-pages li a:hover {
    color: var(--book-accent);
}

/* --- Chapter Index Page --- */
.book-chapter-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--book-border);
}

.book-chapter-label {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--book-accent);
    font-weight: 600;
    margin-bottom: 4px;
}

.book-chapter-header h1 {
    font-size: 2em;
    font-weight: 700;
    color: var(--book-text);
    margin-bottom: 10px;
}

.book-chapter-content {
    font-size: var(--book-font-size);
    line-height: var(--book-line-height);
    color: var(--book-text);
    margin-bottom: 30px;
    max-width: var(--book-content-max-width);
}

.book-in-chapter-heading {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--book-text-light);
    margin-bottom: 20px;
    font-weight: 600;
}

/* Section list on chapter index */
.book-section-list {
    margin-bottom: 40px;
}

.book-section-item {
    margin-bottom: 20px;
    padding-left: 8px;
}

.book-section-item-title {
    font-size: 1.15em;
    font-weight: 600;
    margin-bottom: 6px;
}

.book-section-item-title a {
    color: var(--book-text);
    text-decoration: none;
}

.book-section-item-title a:hover {
    color: var(--book-accent);
}

.book-section-item .book-toc-pages {
    margin-top: 6px;
}

/* --- Section Index Page --- */
.book-section-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--book-border);
}

.book-section-header h1 {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--book-text);
    margin-bottom: 10px;
}

.book-page-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.book-page-list li {
    border: 1px solid var(--book-border);
    border-radius: 4px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.book-page-list li:hover {
    border-color: var(--book-accent);
}

.book-page-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    color: var(--book-text);
    text-decoration: none;
    font-size: 1.05em;
}

.book-page-list li a .book-page-arrow {
    color: var(--book-text-light);
    font-size: 0.85em;
}

/* --- Single Page (Reading View) --- */
.book-reading-layout {
    display: flex;
    gap: 40px;
}

.book-content-area {
    flex: 1;
    min-width: 0;
    max-width: var(--book-content-max-width);
}

.book-content-area h1 {
    font-size: 2em;
    font-weight: 700;
    color: var(--book-text);
    margin-bottom: 24px;
    line-height: 1.3;
}

.book-content-area .book-body {
    font-size: var(--book-font-size);
    line-height: var(--book-line-height);
    color: var(--book-text);
}

.book-content-area .book-body p {
    margin-bottom: 1.2em;
}

.book-content-area .book-body h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin-top: 2em;
    margin-bottom: 0.8em;
    color: var(--book-text);
}

.book-content-area .book-body h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin-top: 1.6em;
    margin-bottom: 0.6em;
    color: var(--book-text);
}

.book-content-area .book-body ul,
.book-content-area .book-body ol {
    padding-left: 1.5em;
    margin-bottom: 1.2em;
}

.book-content-area .book-body li {
    margin-bottom: 0.5em;
}

.book-content-area .book-body blockquote {
    border-left: 3px solid var(--book-accent);
    padding: 0.5em 1em;
    margin: 1.5em 0;
    background: var(--book-accent-light);
    color: var(--book-text);
    font-style: italic;
}

.book-content-area .book-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.5em 0;
}

.book-content-area .book-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.95em;
}

.book-content-area .book-body th,
.book-content-area .book-body td {
    padding: 10px 14px;
    border: 1px solid var(--book-border);
    text-align: left;
}

.book-content-area .book-body th {
    background: var(--book-bg-sidebar);
    font-weight: 600;
}

/* Footnotes */
.book-content-area .book-body .footnote-ref {
    color: var(--book-accent);
    font-size: 0.8em;
    vertical-align: super;
    text-decoration: none;
}

.book-content-area .book-body .footnotes {
    margin-top: 3em;
    padding-top: 1.5em;
    border-top: 1px solid var(--book-border);
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--book-text-light);
}

/* --- Sidebar Navigation --- */
.book-sidebar {
    width: 260px;
    flex-shrink: 0;
}

.book-sidebar-inner {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 20px;
    background: var(--book-bg-sidebar);
    border-radius: 6px;
    font-size: 13px;
}

.book-sidebar-title {
    font-size: 0.95em;
    font-weight: 700;
    color: var(--book-text);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--book-border);
}

.book-sidebar-title a {
    color: var(--book-text);
    text-decoration: none;
}

.book-sidebar-title a:hover {
    color: var(--book-accent);
}

.book-nav-chapter {
    margin-bottom: 12px;
}

.book-nav-chapter-title {
    font-weight: 600;
    color: var(--book-text);
    padding: 4px 0;
    cursor: default;
    font-size: 0.95em;
}

.book-nav-chapter-title a {
    color: var(--book-text);
    text-decoration: none;
}

.book-nav-chapter-title a:hover {
    color: var(--book-accent);
}

.book-nav-section {
    margin: 4px 0 4px 8px;
}

.book-nav-section-title {
    font-weight: 600;
    padding: 3px 0;
    font-size: 0.92em;
}

.book-nav-section-title a {
    color: var(--book-text);
    text-decoration: none;
}

.book-nav-section-title a:hover {
    color: var(--book-accent);
}

.book-nav-pages {
    list-style: none;
    padding: 0;
    margin: 2px 0 2px 6px;
    border-left: 2px solid var(--book-border);
}

.book-nav-pages li {
    padding: 2px 0 2px 10px;
}

.book-nav-pages li a {
    color: var(--book-text-light);
    text-decoration: none;
    line-height: 1.4;
    display: block;
}

.book-nav-pages li a:hover {
    color: var(--book-accent);
}

/* Active page in sidebar */
.book-nav-pages li.active {
    border-left: 2px solid var(--book-accent);
    margin-left: -2px;
}

.book-nav-pages li.active a {
    color: var(--book-accent);
    font-weight: 600;
}

/* Collapsed sections */
.book-nav-section.collapsed .book-nav-pages {
    display: none;
}

/* --- Page Navigation (Prev/Next) --- */
.book-page-nav {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 20px;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--book-border);
}

.book-page-nav a {
    display: block;
    padding: 16px 20px;
    border: 1px solid var(--book-border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--book-text);
    flex: 1;
    transition: border-color 0.2s;
}

.book-page-nav a:hover {
    border-color: var(--book-accent);
}

.book-page-nav .book-nav-label {
    display: block;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--book-text-light);
    margin-bottom: 4px;
}

.book-page-nav .book-nav-title {
    font-weight: 600;
    font-size: 0.95em;
    color: var(--book-accent);
}

.book-page-nav .book-nav-prev {
    text-align: left;
}

.book-page-nav .book-nav-next {
    text-align: right;
}

.book-page-nav .book-nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 16px;
    border: 1px solid var(--book-border);
    border-radius: 4px;
    color: var(--book-text-light);
    text-decoration: none;
    font-size: 1.2em;
}

.book-page-nav .book-nav-center:hover {
    border-color: var(--book-accent);
    color: var(--book-accent);
}

/* --- Chapter Navigation (Prev/Next Chapter) --- */
.book-chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--book-border);
    font-size: 0.9em;
}

.book-chapter-nav a {
    color: var(--book-accent);
    text-decoration: none;
}

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

.book-chapter-nav .book-chapter-nav-spacer {
    flex: 1;
}

/* --- Section Navigation (Prev/Next Section) --- */
.book-section-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-top: 30px;
    border-top: 1px solid var(--book-border);
    font-size: 0.9em;
}

.book-section-nav a {
    color: var(--book-accent);
    text-decoration: none;
}

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

/* --- Responsive --- */
@media (max-width: 991px) {
    .book-reading-layout {
        flex-direction: column;
    }

    .book-sidebar {
        width: 100%;
        order: 2;
        margin-top: 40px;
    }

    .book-sidebar-inner {
        position: static;
        max-height: none;
    }

    .book-content-area {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    :root {
        --book-font-size: 16px;
        --book-line-height: 1.65;
    }

    .book-hero h1 {
        font-size: 1.8em;
    }

    .book-chapter-header h1 {
        font-size: 1.6em;
    }

    .book-content-area h1 {
        font-size: 1.6em;
    }

    .book-page-nav {
        flex-direction: column;
    }

    .book-page-nav .book-nav-center {
        order: -1;
    }
}
