/* public/style.css */

/* ======================================== */
/* === Variables and Theme Setup ======== */
/* ======================================== */
:root {
    /* Dark mode */
    --background-dark: #1e1e1e;
    --surface-dark: #2a2a2a;
    --text-primary-dark: #e0e0e0;
    --text-secondary-dark: #b0b0b0;
    --link-color-dark: #6495ed;
    --accent-color-dark: #8a2be2;
    /* Lilla accent */
    --border-color-dark: #444;
    /* Light mode */
    --background-light: #ffffff;
    --surface-light: #f8f9fa;
    --text-primary-light: #212529;
    --text-secondary-light: #6c757d;
    --link-color-light: #007bff;
    --accent-color-light: #6f42c1;
    /* Mørkere lilla accent */
    --border-color-light: #dee2e6;
    /* Defaults */
    --bg-color: var(--background-dark);
    --surface-color: var(--surface-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --link-color: var(--link-color-dark);
    --accent-color: var(--accent-color-dark);
    --border-color: var(--border-color-dark);
    --theme-transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html.light-mode {
    --bg-color: var(--background-light);
    --surface-color: var(--surface-light);
    --text-primary: var(--text-primary-light);
    --text-secondary: var(--text-secondary-light);
    --link-color: var(--link-color-light);
    --accent-color: var(--accent-color-light);
    --border-color: var(--border-color-light);
}

/* ======================================== */
/* === Basic Layout & Sticky Footer ===== */
/* ======================================== */
html {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--theme-transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

main.container {
    flex-grow: 1;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

/* ======================================== */
/* === Header =========================== */
/* ======================================== */
.site-header {
    background-color: var(--surface-color);
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: var(--theme-transition);
}

.header-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.header-bar { display: flex; align-items: center; }

.site-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.nav-toggle {
    display: none; /* shown only on mobile */
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    line-height: 1;
}
.nav-toggle:hover { background-color: color-mix(in srgb, var(--surface-color) 80%, var(--border-color) 20%); }

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header-right {
    display: flex;
    align-items: center;
}

.site-header a.logo {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--theme-transition);
    white-space: nowrap;
}

.main-nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}

.main-nav-link:hover {
    color: var(--text-primary);
    background-color: color-mix(in srgb, var(--surface-color) 80%, var(--border-color) 20%);
}

.main-nav-link i {
    font-size: 1em;
    line-height: 1;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-nav .logout-link,
.user-nav .signup-link {
    background-color: var(--accent-color);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
}

.user-nav .logout-link:hover,
.user-nav .signup-link:hover {
    background-color: color-mix(in srgb, var(--accent-color) 85%, black);
    color: #fff;
    text-decoration: none;
}

.theme-toggle-button {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 0.8rem;
    line-height: 1;
    transition: var(--theme-transition);
    border-radius: 4px;
}

.theme-toggle-button:hover {
    background-color: color-mix(in srgb, var(--surface-color) 80%, var(--border-color) 20%);
}

/* ======================================== */
/* === Footer =========================== */
/* ======================================== */
.site-footer {
    text-align: center;
    padding: 1.5rem 0;
    background-color: var(--surface-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    width: 100%;
    transition: var(--theme-transition);
}
.site-footer .footer-links { margin-top: 0.5rem; display: flex; justify-content: center; gap: 1.2rem; }
.site-footer .footer-links a { color: var(--text-secondary); text-decoration: none; }
.site-footer .footer-links a:hover { color: var(--accent-color); text-decoration: underline; }

/* === Ad units (render only when AdSense env vars are set) === */
.ad-container { margin: 1.8rem auto; text-align: center; max-width: 100%; overflow: hidden; }
.ad-container .ad-label { display: block; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-secondary); opacity: 0.65; margin-bottom: 0.3rem; }

/* ======================================== */
/* === General Elements ================= */
/* ======================================== */
a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1 {
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 600;
    transition: var(--theme-transition);
}

h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.4rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
    font-weight: 600;
    transition: var(--theme-transition);
}

h2:first-of-type {
    margin-top: 0;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--theme-transition);
}

.back-link:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.back-link i {
    margin-right: 0.3em;
}

.button {
    display: inline-block;
    background-color: var(--accent-color);
    color: #fff;
    padding: 0.7rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.button:hover {
    background-color: color-mix(in srgb, var(--accent-color) 85%, black);
    text-decoration: none;
    color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.button.button-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.button.button-secondary {
    background-color: #6c757d;
}
.button.button-secondary:hover {
    background-color: #5a6268;
}

.button-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--link-color);
    cursor: pointer;
    text-decoration: none;
    font-size: inherit;
    font-family: inherit;
}

.button-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
}

.success-message,
.error-message {
    padding: 0.8rem 1rem; border-radius: 5px; margin-bottom: 1.5rem; text-align: center;
}
.success-message { color: #155724; background-color: #d4edda; border: 1px solid #c3e6cb; }
.error-message { color: #721c24; background-color: #f8d7da; border: 1px solid #f5c6cb; }
.error-message a { color: #721c24; font-weight: bold; text-decoration: underline; }


/* ======================================== */
/* === Index Page (Book Grid) =========== */
/* ======================================== */
#searchInput {
    padding: 0.6rem 1rem; font-size: 1rem; width: 80%; max-width: 500px;
    border: 1px solid var(--border-color); background-color: var(--surface-color);
    color: var(--text-primary); border-radius: 5px; transition: var(--theme-transition);
}
#noResultsMessage { color: var(--text-secondary); transition: var(--theme-transition); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.5rem; padding: 0; list-style: none; }
.book-item { background-color: var(--surface-color); border-radius: 8px; overflow: hidden; transition: transform 0.2s ease-in-out, var(--theme-transition); text-align: center; padding-bottom: 0.8rem; border: 1px solid var(--border-color); }
.book-item:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); }
.book-item a { display: block; text-decoration: none; color: var(--text-primary); transition: var(--theme-transition); }
.book-item img { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; display: block; border-bottom: 1px solid var(--border-color); transition: var(--theme-transition); }
.book-item .title { font-size: 0.9rem; font-weight: 600; padding: 0.5rem 0.5rem 0; margin: 0; display: -webkit-box; line-clamp: 0; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; min-height: 2.7em; }

/* ======================================== */
/* === Homepage Shelves (Popular / Recently Updated) === */
/* ======================================== */
.shelf { margin-bottom: 2.2rem; }
.shelf-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.shelf-heading h2 { margin: 0; font-size: 1.25rem; display: flex; align-items: center; gap: 0.5em; }
.shelf-see-all { font-size: 0.9rem; color: var(--link-color); text-decoration: none; white-space: nowrap; transition: var(--theme-transition); }
.shelf-see-all:hover { text-decoration: underline; }
.shelf-subtitle { font-size: 0.85rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-body { position: relative; }
.shelf-scroll {
    display: flex;
    gap: 1.2rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.2rem 0.2rem 1rem;
    scroll-snap-type: x mandatory;
    /* Arrows (desktop) / swipe (touch) drive the shelf; keep the bar invisible. */
    scrollbar-width: none;
}
.shelf-scroll::-webkit-scrollbar { display: none; }
.shelf-scroll .book-item { flex: 0 0 150px; scroll-snap-align: start; }

/* Paging arrows, shown only when the shelf actually overflows (see initShelfArrows). */
.shelf-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, var(--theme-transition);
}
.shelf-body.has-overflow .shelf-arrow { display: flex; }
.shelf-arrow:hover:not(:disabled) { background-color: var(--accent-color); border-color: var(--accent-color); color: #fff; }
.shelf-arrow:disabled { opacity: 0.35; cursor: default; }
.shelf-arrow-prev { left: -12px; }
.shelf-arrow-next { right: -12px; }
/* Touch devices scroll shelves by swiping; arrows would just get in the way. */
@media (pointer: coarse) { .shelf-body.has-overflow .shelf-arrow { display: none; } }

/* Follower-count badge on Popular shelf cards */
.book-followers {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.3em;
    padding: 0 0.5rem;
}

/* ======================================== */
/* === Book Detail Page ================= */
/* ======================================== */
.book-details-layout { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 1.5rem; }
.book-cover-container { flex: 0 0 220px; max-width: 100%; }
.book-cover-large { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-color); transition: var(--theme-transition); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); }
.book-info-container { flex: 1 1 400px; min-width: 0; }
.book-info-container h1 { text-align: left; margin-top: 0; margin-bottom: 0.5rem; font-size: 2rem; }
.book-author { font-size: 1rem; color: var(--text-secondary); margin-top: -0.5rem; margin-bottom: 1.2rem; }
.tags-section { margin-bottom: 1.2rem; }
.tags-list { list-style: none; padding: 0; margin: 0.5rem 0 0 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.tag-item { background-color: var(--surface-color); color: var(--text-secondary); padding: 0.3rem 0.8rem; border-radius: 15px; font-size: 0.8rem; border: 1px solid var(--border-color); transition: var(--theme-transition); text-transform: capitalize; }
.description-section { margin-bottom: 1.5rem; }
.description-content { padding: 0; transition: var(--theme-transition); line-height: 1.7; color: var(--text-secondary); }
.description-content p:first-child { margin-top: 0; } .description-content p:last-child { margin-bottom: 0; }
.description-content * { color: inherit; } .description-content a { color: var(--link-color); text-decoration: underline; }
.description-content a:hover { color: var(--accent-color); }
.continue-reading-section { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px dashed var(--border-color); text-align: center; }
.continue-reading-section p { margin-bottom: 0.8rem; font-size: 0.9rem; color: var(--text-secondary); }
.continue-reading-button { padding: 0.8rem 2rem; font-size: 1rem; } .continue-reading-button i { margin-right: 0.5em; }
.continue-reading-button.disabled { background-color: var(--surface-color); color: var(--text-secondary); cursor: not-allowed; box-shadow: none; transform: none; border: 1px solid var(--border-color); }
.continue-reading-button.disabled:hover { background-color: var(--surface-color); color: var(--text-secondary); }
.statistics-section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px dashed var(--border-color); transition: var(--theme-transition); }
.stats-placeholder p { margin: 0.5rem 0; color: var(--text-primary); font-size: 0.95rem; transition: var(--theme-transition); }
.stats-placeholder .stat-value { color: var(--text-secondary); font-weight: normal; }

/* --- Styling for Chapter List --- */
.chapter-list-section { margin-top: 2rem; }

/* === Chapter List Controls & Pagination === */
.chapter-list-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding: 0.5rem 0; flex-wrap: wrap; gap: 1rem; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); margin-top: 1rem; }
.chapter-go-to { display: flex; align-items: center; gap: 0.5rem; }
.chapter-go-to input[type="number"] { padding: 0.4rem 0.6rem; font-size: 0.9rem; width: 80px; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-primary); border-radius: 4px; text-align: center; }
.chapter-go-to input[type=number]::-webkit-outer-spin-button, .chapter-go-to input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.chapter-go-to input[type=number] { -moz-appearance: textfield; }
.chapter-go-to button { padding: 0.4rem 0.8rem; font-size: 0.9rem; /* Bruger .button .button-small */ }
.chapter-go-to .error-message { border: none; background: none; padding: 0 !important; margin: 0 !important; color: #dc3545; } /* Nulstil fejlbesked styling */

.pagination-controls { display: flex; justify-content: flex-end; align-items: center; gap: 0.3rem; list-style: none; padding: 0; margin: 0; }
.pagination-controls .page-item a, .pagination-controls .page-item span { display: inline-block; padding: 0.4rem 0.8rem; min-width: 30px; text-align: center; border: 1px solid var(--border-color); background-color: var(--surface-color); color: var(--link-color); text-decoration: none; border-radius: 4px; font-size: 0.9rem; transition: background-color 0.2s ease, color 0.2s ease; }
.pagination-controls .page-item a:hover { background-color: var(--accent-color); border-color: var(--accent-color); color: #fff; text-decoration: none; }
.pagination-controls .page-item.active span, .pagination-controls .page-item.active a { background-color: var(--accent-color); border-color: var(--accent-color); color: #fff; font-weight: 600; cursor: default; }
.pagination-controls .page-item.disabled span, .pagination-controls .page-item.disabled a { color: var(--text-secondary); background-color: var(--surface-color); border-color: var(--border-color); opacity: 0.6; cursor: default; pointer-events: none; }
.pagination-controls .page-item.dots span { border: none; background: none; padding: 0.4rem 0.3rem; min-width: auto; opacity: 0.6; }

/* === Homepage hero (discovery model) === */
.home-hero { text-align: center; padding: 2rem 1rem 2.2rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); }
.home-hero h1 { margin: 0 0 0.4rem 0; font-size: 2rem; }
.home-hero .hero-sub { margin: 0 0 1.2rem 0; color: var(--text-secondary); }
.hero-search { display: flex; justify-content: center; gap: 0.5rem; max-width: 560px; margin: 0 auto 0.9rem; }
.hero-search input[type="search"] { flex: 1 1 auto; padding: 0.65rem 1rem; font-size: 1rem; border: 1px solid var(--border-color); background-color: var(--surface-color); color: var(--text-primary); border-radius: 6px; transition: var(--theme-transition); }
.hero-browse-link { color: var(--link-color); text-decoration: none; font-size: 0.95rem; }
.hero-browse-link:hover { text-decoration: underline; }

/* === Browse page filters === */
.browse-filters { display: flex; justify-content: center; align-items: stretch; gap: 0.5rem; margin: 0 0 1rem 0; flex-wrap: wrap; }
.browse-filters input[type="search"] { flex: 1 1 260px; max-width: 460px; padding: 0.6rem 1rem; font-size: 1rem; border: 1px solid var(--border-color); background-color: var(--surface-color); color: var(--text-primary); border-radius: 6px; transition: var(--theme-transition); }
.browse-filters select { padding: 0.6rem 0.8rem; font-size: 0.95rem; border: 1px solid var(--border-color); background-color: var(--surface-color); color: var(--text-primary); border-radius: 6px; cursor: pointer; transition: var(--theme-transition); }
.tag-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.45rem; margin: 0 0 1.6rem 0; }
.list-tab-more { font-style: italic; }

/* === Book status chip (Ongoing / Completed / Hiatus...) === */
.status-chip { display: inline-block; margin-left: 0.6em; padding: 0.15em 0.7em; border-radius: 12px; font-size: 0.72em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; vertical-align: middle; border: 1px solid var(--border-color); color: var(--text-secondary); }
.status-chip.status-ongoing { color: #2eaa5e; border-color: #2eaa5e; }
.status-chip.status-completed { color: #4d8fd1; border-color: #4d8fd1; }
.status-chip.status-hiatus { color: #d1a04d; border-color: #d1a04d; }

/* === Ranking sort tabs (book_list.ejs) === */
.list-tabs { display: flex; justify-content: center; gap: 0.6rem; margin: 0 0 1.5rem 0; flex-wrap: wrap; }
.list-tab { padding: 0.45rem 1.1rem; border: 1px solid var(--border-color); border-radius: 20px; background-color: var(--surface-color); color: var(--text-primary); text-decoration: none; font-size: 0.92rem; transition: background-color 0.2s ease, color 0.2s ease, var(--theme-transition); }
.list-tab:hover { border-color: var(--accent-color); color: var(--accent-color); text-decoration: none; }
.list-tab.active { background-color: var(--accent-color); border-color: var(--accent-color); color: #fff; cursor: default; }

/* === Shared list pagination (homepage + browse pages) === */
.pagination-wrap { display: flex; justify-content: center; margin: 1.75rem 0 0.5rem; }
.pagination-wrap .pagination-controls { justify-content: center; flex-wrap: wrap; }
.catalog-count { color: var(--text-secondary); font-size: 0.6em; font-weight: 400; }

/* === Paginated Chapter List === */
.chapter-list-paginated { list-style: none; padding: 0; margin: 1rem 0 0 0; column-count: 2; column-gap: 1.5rem; background-color: var(--surface-color); padding: 1rem 1.5rem; border: 1px solid var(--border-color); border-radius: 8px; transition: var(--theme-transition); }
@media (max-width: 768px) { .chapter-list-paginated { column-count: 1; } }
.chapter-list-paginated li { margin: 0; padding: 0; break-inside: avoid-column; page-break-inside: avoid; border-bottom: 1px solid var(--border-color); transition: var(--theme-transition); }
.chapter-list-paginated li:last-child { border-bottom: none; }
.chapter-list-paginated a { display: flex; justify-content: flex-start; align-items: center; flex-wrap: nowrap; gap: 0.8rem; padding: 0.7rem 0.5rem; color: var(--text-primary); text-decoration: none; transition: background-color 0.2s ease, color 0.2s ease, var(--theme-transition); font-size: 0.9rem; overflow: hidden; }
.chapter-list-paginated a:hover { background-color: color-mix(in srgb, var(--surface-color) 85%, var(--accent-color) 10%); text-decoration: none; color: var(--accent-color); }
.chapter-list-paginated .chapter-number { flex-shrink: 0; font-weight: normal; color: var(--text-secondary); min-width: 30px; text-align: left; transition: color 0.2s ease; margin-right: 0.5em; }
.chapter-list-paginated a:hover .chapter-number { color: var(--accent-color); }
.chapter-list-paginated .chapter-title { flex-grow: 1; text-align: left; color: var(--text-primary); transition: color 0.2s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-list-paginated a:hover .chapter-title { color: var(--accent-color); }
.chapter-list-paginated .chapter-date { flex-shrink: 0; font-size: 0.8em; color: var(--text-secondary); margin-left: auto; padding-left: 1em; white-space: nowrap; }

/* --- Review Section Styles --- */
.reviews-section { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }
.reviews-section h2 { margin-bottom: 1.5rem; text-align: left; border-bottom: 1px solid var(--border-color); padding-bottom: 0.4rem; }
.review-list { list-style: none; padding: 0; margin: 1.5rem 0 0 0; }
.review-item { background-color: var(--surface-color); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.2rem 1.5rem; margin-bottom: 1.5rem; display: flex; gap: 1rem; }
.review-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); }
.review-main { flex-grow: 1; }
.review-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.6rem; font-size: 0.9rem; flex-wrap: wrap; gap: 0.5rem; }
.review-author { font-weight: 600; color: var(--text-primary); }
.review-rating { color: #ffc107; } .review-rating .fa-star { margin-right: 0.1em; }
.review-date { color: var(--text-secondary); font-size: 0.85em; }
.review-body { margin-bottom: 0.8rem; } .review-body p { margin: 0; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.review-actions { display: flex; gap: 1rem; align-items: center; margin-top: 0.5rem; font-size: 0.85rem; }
.review-actions button, .review-actions a { color: var(--text-secondary); cursor: pointer; background: none; border: none; padding: 0; font-size: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3em; }
.review-actions button:hover, .review-actions a:hover { color: var(--accent-color); text-decoration: underline;}
.review-actions form { display: inline; margin: 0; } .review-actions form button { margin: 0; padding: 0; }
.review-actions form button:hover { color: #dc3545; } /* Rød hover for delete */
.spoiler-tag { background-color: var(--accent-color); color: white; font-size: 0.7rem; padding: 0.1em 0.4em; border-radius: 3px; margin-left: 0.5em; text-transform: uppercase; font-weight: bold; }
.no-reviews { text-align: center; color: var(--text-secondary); margin-top: 1rem; }
.add-review-form { background-color: var(--surface-color); padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem; border: 1px solid var(--border-color); transition: var(--theme-transition); }
.add-review-form h3 { margin-top: 0; margin-bottom: 1rem; font-size: 1.2rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.add-review-form .form-group { margin-bottom: 1rem; }
.add-review-form label { display: block; margin-bottom: 0.5rem; color: var(--text-secondary); font-weight: 500; }
.add-review-form textarea { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-primary); border-radius: 5px; font-size: 1rem; box-sizing: border-box; min-height: 80px; resize: vertical; transition: var(--theme-transition), border-color 0.2s ease; }
.add-review-form textarea:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 20%, transparent); }
.add-review-form .rating-input { margin-bottom: 1rem; /* Tilføjet margin */ }
.add-review-form .rating-input span { font-size: 1.5rem; color: var(--text-secondary); cursor: pointer; margin-right: 0.2em; transition: color 0.1s ease; }
.add-review-form .rating-input span:hover, .add-review-form .rating-input span.selected { color: #ffc107; }
.add-review-form .checkbox-group { display: flex; align-items: center; gap: 0.5em; }
.add-review-form .checkbox-group label { margin-bottom: 0; }
.add-review-form .form-actions { text-align: right; margin-top: 1rem; }
.review-login-prompt { text-align: center; margin: 2rem 0; color: var(--text-secondary); background-color: var(--surface-color); padding: 1rem; border-radius: 5px; }
.review-login-prompt a { color: var(--link-color); font-weight: bold; }

/* --- Spoiler Styles --- */
.spoiler-content { background-color: var(--text-primary); color: var(--text-primary); padding: 0.2em 0.4em; border-radius: 3px; cursor: pointer; transition: color 0.2s ease, background-color 0.2s ease; user-select: none; display: inline-block; }
.spoiler-content:hover { background-color: color-mix(in srgb, var(--text-primary) 80%, var(--bg-color) 20%); }
.spoiler-content.revealed { background-color: transparent; color: var(--text-primary); cursor: default; user-select: text; }


/* ======================================== */
/* === Chapter Page ===================== */
/* ======================================== */
/* === Link-out reading (discovery model) === */
.read-source-button { display: block; width: 100%; text-align: center; margin-top: 0.8rem; box-sizing: border-box; }
.chapter-ext-icon { margin-left: auto; flex-shrink: 0; font-size: 0.7em; color: var(--text-secondary); opacity: 0.6; }
.chapter-list-paginated a:hover .chapter-ext-icon { color: var(--accent-color); opacity: 1; }
.similar-books-section { margin-top: 2.5rem; }
.chapter-content { background-color: var(--surface-color); padding: 1.5rem 2rem; border-radius: 8px; border: 1px solid var(--border-color); line-height: 1.75; margin-top: 1.5rem; transition: var(--theme-transition), font-size 0.2s ease; color: var(--text-primary); font-size: 16px; }
.chapter-content p { margin-bottom: 1.3em; } .chapter-content * { color: inherit; }
.chapter-content a { color: var(--link-color); text-decoration: underline; } .chapter-content a:hover { color: var(--accent-color); }
.chapter-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; margin-top: 2.5rem; margin-bottom: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); transition: var(--theme-transition); }
.nav-item { display: flex; } .nav-item.prev-item { justify-content: flex-start; } .nav-item.home-item { justify-content: center; } .nav-item.next-item { justify-content: flex-end; }
.nav-button { display: inline-flex; align-items: center; gap: 0.5em; padding: 0.7rem 1.4rem; border: 1px solid var(--border-color); border-radius: 5px; color: var(--link-color); text-decoration: none; font-weight: 500; transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, var(--theme-transition); }
.nav-button.home { padding: 0.7rem 1rem; } .nav-button i { line-height: 1; }
.nav-button:hover:not(:disabled) { background-color: var(--accent-color); border-color: var(--accent-color); color: #fff; text-decoration: none; }
.nav-button.disabled { color: var(--text-secondary); border-color: transparent; background-color: transparent; cursor: default; opacity: 0.6; }

/* ======================================== */
/* === Comments Section (Chapter Page) ==== */
/* ======================================== */
.comments-section { margin-top: 3rem; padding-top: 1.5rem; border-top: 2px solid var(--border-color); }
.comments-section h2 { margin-top: 0; margin-bottom: 1.5rem; text-align: center; border-bottom: none; }
.comment-form { background-color: var(--surface-color); padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem; border: 1px solid var(--border-color); transition: var(--theme-transition); }
.comment-form .form-group { margin-bottom: 1rem; }
.comment-form label { display: block; margin-bottom: 0.5rem; color: var(--text-secondary); font-weight: 500; }
.comment-form label strong { color: var(--text-primary); font-style: italic; }
.comment-form textarea { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-primary); border-radius: 5px; font-size: 1rem; box-sizing: border-box; min-height: 80px; resize: vertical; transition: var(--theme-transition), border-color 0.2s ease; }
.comment-form textarea:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 20%, transparent); }
.comment-form-buttons { margin-bottom: 0; text-align: right; display: flex; justify-content: flex-end; gap: 0.5rem; align-items: center; }
.comment-submit-button { padding: 0.6rem 1.2rem; } .cancel-reply-button { font-size: 0.9rem; }
.comment-form .spoiler-checkbox { /* Styling for spoiler checkbox in comment form */ display: flex; align-items: center; gap: 0.5em; margin-bottom: 1rem; font-size: 0.9rem; color: var(--text-secondary); }
.comment-form .spoiler-checkbox input[type="checkbox"] { width: 1em; height: 1em; accent-color: var(--accent-color); }
.comment-form .spoiler-checkbox label { margin-bottom: 0; /* Override default label margin */ }
.comment-login-prompt { text-align: center; margin: 2rem 0; color: var(--text-secondary); background-color: var(--surface-color); padding: 1rem; border-radius: 5px; }
.comments-list { margin-top: 2rem; } .no-comments-yet { color: var(--text-secondary); text-align: center; margin-top: 1rem; }
.comment-item { display: flex; gap: 1rem; background-color: var(--surface-color); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.2rem 1.5rem; margin-bottom: 1.5rem; transition: var(--theme-transition); position: relative; }
.comment-reply { margin-left: calc(var(--indent-level, 1) * 2.5rem); margin-top: 1rem; border-left: 3px solid var(--border-color); padding-left: 1rem; margin-bottom: 1rem; }
@media (max-width: 600px) { .comment-reply { margin-left: calc(var(--indent-level, 1) * 1.5rem); padding-left: 0.8rem; } }
.comment-replies { margin-top: 1rem; }
.toggle-replies-btn { display: inline-block; margin-top: 0.8rem; font-size: 0.85rem; color: var(--text-secondary); cursor: pointer; background: none; border: none; padding: 0.2rem 0.4rem; border-radius: 4px; transition: color 0.2s ease, background-color 0.2s ease; }
.toggle-replies-btn:hover { color: var(--accent-color); background-color: color-mix(in srgb, var(--surface-color) 80%, var(--border-color) 20%); }
.toggle-replies-btn i { margin-right: 0.4em; transition: transform 0.2s ease-in-out; } .toggle-replies-btn[data-expanded="true"] i { transform: rotate(-180deg); }
.comment-avatar { flex-shrink: 0; width: 40px; height: 40px; } .avatar-image { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); }
.comment-main { flex-grow: 1; display: flex; flex-direction: column; }
.comment-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; font-size: 0.9rem; flex-wrap: wrap; gap: 0.5rem; }
.comment-meta>div { display: flex; align-items: baseline; gap: 0.5em; flex-wrap: wrap; }
.comment-author { font-weight: 600; color: var(--text-primary); } .comment-date { color: var(--text-secondary); font-size: 0.85em; white-space: nowrap; }
.reply-target { font-size: 0.9em; color: var(--text-secondary); font-weight: 500; } .reply-target i { font-size: 0.9em; margin-right: 0.2em; }
.comment-body { margin-bottom: 0.8rem; } .comment-body p { margin: 0; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.edit-comment-form { margin-top: 0.5rem; margin-bottom: 0.8rem; }
.edit-comment-form textarea { font-size: 0.95rem; min-height: 60px; width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-primary); border-radius: 5px; box-sizing: border-box; resize: vertical; transition: var(--theme-transition), border-color 0.2s ease; }
.edit-comment-form textarea:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 20%, transparent); }
.edit-buttons { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.5rem; } .edit-buttons .button { padding: 0.4rem 1rem; } .edit-buttons .button-link { font-size: 0.9rem; padding: 0.4rem 0; }
.comment-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); flex-wrap: wrap; gap: 0.5rem; }
.left-actions, .right-actions { display: flex; align-items: center; gap: 1rem; }
.comment-actions .reply-button, .comment-actions .options-button { color: var(--text-secondary); cursor: pointer; background: none; border: none; padding: 0; font-size: inherit; }
.comment-actions .reply-button:hover, .comment-actions .options-button:hover { color: var(--accent-color); } .comment-actions .reply-button i, .comment-actions .options-button i { margin-right: 0.3em; }
.comment-options { position: relative; display: inline-block; }
.options-dropdown { position: absolute; background-color: var(--surface-color); border: 1px solid var(--border-color); border-radius: 4px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2); padding: 0.5rem 0; min-width: 100px; z-index: 10; right: 0; margin-top: 0.2rem; }
.options-dropdown.hidden { display: none; }
.dropdown-item { display: block; background: none; border: none; color: var(--text-primary); padding: 0.5rem 1rem; text-align: left; width: 100%; cursor: pointer; font-size: 0.85rem; }
.dropdown-item:hover { background-color: var(--accent-color); color: #fff; }
.dropdown-item.delete-button { color: #dc3545; } .dropdown-item.delete-button:hover { color: #fff; background-color: #dc3545; }
.delete-comment-form { display: block; margin: 0; padding: 0; } .delete-comment-form .dropdown-item { width: 100%; }
.vote-form { display: inline-block; margin: 0; }
.vote-button { color: var(--text-secondary); display: inline-flex; align-items: center; gap: 0.4em; padding: 0.2rem 0.4rem; border-radius: 4px; transition: color 0.2s ease, background-color 0.2s ease; background: none; border: none; }
.vote-button:hover:not(:disabled) { background-color: color-mix(in srgb, var(--surface-color) 80%, var(--border-color) 20%); color: var(--accent-color); text-decoration: none; }
.vote-button i { font-size: 1.1em; } .vote-count { font-size: 0.9em; font-weight: 500; min-width: 1.2em; text-align: center; }
.vote-button.active.like-button { color: #28a745; } .vote-button.active.dislike-button { color: #dc3545; }
.vote-button:disabled { opacity: 0.6; cursor: default; } .vote-button:disabled:hover { background-color: transparent; color: var(--text-secondary); }

/* ======================================== */
/* === Login Required Popup ============= */
/* ======================================== */
.popup { position: fixed; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 1; transition: opacity 0.3s ease; }
.popup.hidden { opacity: 0; pointer-events: none; }
.popup-content { background-color: var(--surface-color); padding: 2rem 2.5rem; border-radius: 8px; border: 1px solid var(--border-color); text-align: center; position: relative; min-width: 300px; max-width: 90%; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3); }
.popup-close { position: absolute; top: 0.5rem; right: 0.8rem; background: none; border: none; font-size: 1.8rem; line-height: 1; color: var(--text-secondary); cursor: pointer; }
.popup-close:hover { color: var(--text-primary); }
.popup-content p { color: var(--text-primary); margin-bottom: 1.5rem; font-size: 1.1rem; }
.popup-actions { display: flex; justify-content: center; gap: 1rem; }

/* ======================================== */
/* === Authentication Pages ============= */
/* ======================================== */
.auth-container { max-width: 500px; margin: 2rem auto; }
.auth-container h1 { text-align: center; margin-bottom: 2rem; }
.auth-form { background-color: var(--surface-color); padding: 2rem; border-radius: 8px; border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); transition: var(--theme-transition); }
.auth-form .form-group { margin-bottom: 1.5rem; }
.auth-form label { display: block; margin-bottom: 0.5rem; color: var(--text-secondary); font-weight: 500; }
.auth-form input[type="text"], .auth-form input[type="password"] { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-primary); border-radius: 5px; font-size: 1rem; box-sizing: border-box; transition: var(--theme-transition), border-color 0.2s ease; }
.auth-form input[type="text"]:focus, .auth-form input[type="password"]:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 20%, transparent); }
.auth-form small { display: block; margin-top: 0.3rem; font-size: 0.85rem; color: var (--text-secondary); }
.auth-form .form-group:last-child { margin-bottom: 0; text-align: center; margin-top: 2rem; }
.auth-container p { text-align: center; margin-top: 1.5rem; color: var(--text-secondary); }
.auth-container p a { color: var(--link-color); font-weight: 500; }

/* ======================================== */
/* === Profile Page ===================== */
/* ======================================== */
.profile-page h1 { text-align: left; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; margin-bottom: 2rem; }
.profile-layout { display: flex; flex-wrap: wrap; gap: 2rem; }
.profile-sidebar { flex: 0 0 250px; max-width: 100%; text-align: center; }
.profile-avatar-large { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; border: 3px solid var(--border-color); margin-bottom: 1rem; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); }
.profile-sidebar h2 { border-bottom: none; margin-bottom: 0.2rem; padding-bottom: 0; text-align: center; font-size: 1.5rem; }
.profile-registered { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.profile-picture-form { margin-bottom: 1rem; }
.upload-button { display: block; margin-bottom: 0.5rem; cursor: pointer; background-color: var(--surface-color); color: var(--text-primary); border: 1px solid var(--border-color); padding: 0.7rem 1rem; font-weight: 500; border-radius: 5px; }
.upload-button:hover { background-color: var(--border-color); } .upload-button i { margin-right: 0.5em; }
.save-picture-button { display: none; width: 100%; margin-top: 0.5rem; }
.profile-sidebar .logout-button {
    padding: 0.7rem 1rem;
    font-weight: 500;
    border-radius: 5px;
    width: 100%;
    display: block;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: #6c757d;
    color: #fff;
    text-align: center;
    border: none;
    margin-top: 0.5rem;
}
.profile-sidebar .logout-button:hover {
    background-color: #5a6268;
}
.profile-main-content { flex: 1 1 500px; min-width: 0; }
.profile-section { background-color: var(--surface-color); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5rem 2rem; margin-bottom: 1.5rem; }
.profile-section h2 { margin-top: 0; margin-bottom: 1rem; font-size: 1.3rem; padding-bottom: 0.5rem; }
.profile-section ul { list-style: none; padding: 0; margin: 0; }
.profile-section li { margin-bottom: 0.8rem; color: var(--text-secondary); }
.profile-section li strong { color: var(--text-primary); margin-right: 0.5em; min-width: 120px; display: inline-block; }
.profile-section li a { color: var(--link-color); } .profile-section li a:hover { color: var(--accent-color); }

/* === Library Controls (Book Page) === */
.library-controls { margin-top: 1.5rem; padding: 1rem; background-color: var(--surface-color); border: 1px solid var(--border-color); border-radius: 5px; text-align: center; transition: var(--theme-transition); }
.library-controls .button { width: 100%; padding: 0.6rem 1rem; font-size: 0.9rem; }
.library-controls .button-secondary { background-color: #6c757d; margin-top: 0.5rem; } .library-controls .button-secondary:hover { background-color: #5a6268; }
.status-selector { margin-bottom: 1rem; } .status-selector label { margin-right: 0.5em; color: var(--text-secondary); font-size: 0.9rem; }
.status-select-dropdown { padding: 0.5rem 0.8rem; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-primary); border-radius: 4px; font-size: 0.9rem; cursor: pointer; transition: var(--theme-transition); }
.status-select-dropdown:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 20%, transparent); }
.library-login-prompt { font-size: 0.9rem; color: var(--text-secondary); }
.library-message { font-size: 0.85rem; padding: 0.5em; border-radius: 3px; }
.library-message.success { color: #155724; background-color: #d4edda; }
.library-message.error { color: #721c24; background-color: #f8d7da; }

/* === Library Page === */
.library-filters { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); display: flex; gap: 0.8rem; flex-wrap: wrap; }
.filter-button { display: inline-block; padding: 0.4rem 1rem; border: 1px solid var(--border-color); background-color: var(--surface-color); color: var(--text-secondary); border-radius: 15px; text-decoration: none; font-size: 0.9rem; transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.filter-button:hover { background-color: var(--border-color); color: var(--text-primary); text-decoration: none; }
.filter-button.active { background-color: var(--accent-color); color: #fff; border-color: var(--accent-color); font-weight: 600; }
.library-list { list-style: none; padding: 0; margin: 1.5rem 0 0 0; }
.library-list-header { display: grid; grid-template-columns: 50px 1fr 100px 100px 50px; gap: 1rem; padding: 0.5rem 1rem; font-weight: 600; color: var(--text-secondary); font-size: 0.9rem; border-bottom: 2px solid var(--border-color); margin-bottom: 0.5rem; text-align: left; }
.library-list-header .col-progress, .library-list-header .col-status { text-align: right; } .library-list-header .col-actions { text-align: center; }
@media (max-width: 700px) { .library-list-header { display: none; } }
.library-list-item { display: grid; grid-template-columns: 50px 1fr 100px 100px 50px; gap: 1rem; align-items: center; padding: 0.8rem 1rem; background-color: var(--surface-color); border-bottom: 1px solid var(--border-color); transition: background-color 0.2s ease; }
.library-list-item:hover { background-color: color-mix(in srgb, var(--surface-color) 90%, var(--border-color) 10%); }
.lib-item-cover img { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px; display: block; }
.lib-item-info { display: flex; flex-direction: column; gap: 0.2rem; overflow: hidden; }
.lib-item-title { font-weight: 600; color: var(--text-primary); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item-title:hover { color: var(--accent-color); text-decoration: underline; }
.lib-item-meta { font-size: 0.8rem; color: var(--text-secondary); display: flex; gap: 0.5em; align-items: center; flex-wrap: wrap; }
.lib-item-meta .updated-badge { background-color: #28a745; color: white; font-size: 0.7rem; padding: 0.1em 0.4em; border-radius: 3px; font-weight: bold; text-transform: uppercase; line-height: 1; white-space: nowrap; }
.lib-item-meta .fa-clock { font-size: 0.9em; }
.lib-item-progress { font-size: 0.85rem; color: var(--text-secondary); text-align: right; }
.lib-item-progress .percent { font-size: 0.8em; display: block; margin-top: 0.1em; }
.lib-item-status { font-size: 0.85rem; text-align: right; text-transform: capitalize; color: var(--text-primary); }
.lib-item-actions { text-align: center; }
.lib-item-actions button { background: none; border: none; color: var(--text-secondary); font-size: 1.1rem; cursor: pointer; padding: 0.3rem; line-height: 1; border-radius: 4px; }
.lib-item-actions button:hover { color: var(--text-primary); background-color: var(--border-color); }
@media (max-width: 700px) { .library-list-item { grid-template-columns: 50px 1fr 80px; gap: 0.8rem; padding: 0.6rem 0.8rem; } .lib-item-status, .lib-item-actions { display: none; } .lib-item-info { grid-column: 2 / 3; } .lib-item-progress { grid-column: 3 / 4; font-size: 0.8rem; } .lib-item-meta .lib-status-mobile { display: inline-block !important; margin-left: 0.5em; padding: 0.1em 0.4em; background-color: var(--border-color); border-radius: 3px; font-size: 0.9em; text-transform: capitalize; } }
.no-books-message { text-align: center; margin-top: 2rem; color: var(--text-secondary); }

/* === Edit Review Page === */
.edit-review-container { max-width: 700px; margin: 2rem auto; }
.edit-review-form { background-color: var(--surface-color); padding: 2rem; border-radius: 8px; border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); transition: var(--theme-transition); }
.edit-review-form h1 { text-align: center; margin-bottom: 1.5rem; }
.edit-review-form .form-group { margin-bottom: 1.5rem; }
.edit-review-form label { display: block; margin-bottom: 0.5rem; color: var(--text-secondary); font-weight: 500; }
.edit-review-form textarea { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-primary); border-radius: 5px; font-size: 1rem; box-sizing: border-box; min-height: 120px; resize: vertical; transition: var(--theme-transition), border-color 0.2s ease; }
.edit-review-form textarea:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 20%, transparent); }
.edit-review-form .rating-input { margin-bottom: 1rem; } /* Tilføjet margin */
.edit-review-form .rating-input span { font-size: 1.5rem; color: var(--text-secondary); cursor: pointer; margin-right: 0.2em; transition: color 0.1s ease; }
.edit-review-form .rating-input span:hover, .edit-review-form .rating-input span.selected { color: #ffc107; }
.edit-review-form .checkbox-group { display: flex; align-items: center; gap: 0.5em; }
.edit-review-form .checkbox-group label { margin-bottom: 0; }
.edit-review-form .form-actions { text-align: right; display: flex; justify-content: flex-end; gap: 1rem; margin-top: 1.5rem; }

/* --- Styling for Chapter List (Flyttet fra book.ejs) --- */
.chapter-list-section {
    margin-top: 2rem;
}

/* --- Go To Chapter Form --- */
.go-to-chapter-form {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--surface-color);
    padding: 0.8rem 1rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    max-width: 400px; /* Limit width */
}

.go-to-chapter-form label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.go-to-chapter-form input[type="number"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 0.9rem;
    width: 80px; /* Fixed width for number input */
    transition: var(--theme-transition), border-color 0.2s ease;
}

.go-to-chapter-form input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 20%, transparent);
}

.go-to-chapter-form .button-link {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.go-to-chapter-form .button-link:hover {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    text-decoration: none;
}

/* --- Chapter List UL --- */
.chapter-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
    background-color: var(--surface-color);
    padding: 1rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--theme-transition);
}

.chapter-list li {
    margin-bottom: 0.2rem; /* Reduced margin */
    border-bottom: 1px solid var(--border-color); /* Separator line */
    padding: 0.5rem 0; /* Padding for spacing */
}

.chapter-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.chapter-list a {
    display: flex; /* Use flexbox for alignment */
    justify-content: space-between; /* Space out elements */
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    transition: color 0.2s ease, background-color 0.2s ease;
    gap: 1rem; /* Gap between elements */
}

.chapter-list a:hover {
    color: var(--accent-color);
    background-color: color-mix(in srgb, var(--surface-color) 85%, var(--accent-color) 10%);
    text-decoration: none;
}

.chapter-list .chapter-number {
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 0.5em;
    transition: color 0.2s ease;
    flex-shrink: 0; /* Prevent shrinking */
}

.chapter-list .chapter-title {
    flex-grow: 1; /* Allow title to take up space */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.chapter-list .chapter-date {
    font-size: 0.85em;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0; /* Prevent shrinking */
}

.chapter-list a:hover .chapter-number {
    color: var(--accent-color);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.page-link {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    min-width: 30px; /* Ensure minimum width */
    text-align: center;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--link-color);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.page-link:hover:not(.disabled):not(.active) {
    background-color: var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
}

.page-link.active {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    font-weight: 600;
    cursor: default;
}

.page-link.disabled {
    color: var(--text-secondary);
    opacity: 0.6;
    cursor: default;
    background-color: transparent;
    border-color: transparent;
}

.page-link.ellipsis {
    border: none;
    background: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.2rem;
    cursor: default;
}

/* --- SLUT PÅ FLYTTET STYLING --- */
/* ---------------------------------------------------------------------------
   Rating display (added: average ratings on cards + book detail)
   --------------------------------------------------------------------------- */
.book-rating {
    margin-top: 0.25rem;
    font-size: 0.82rem;
    color: #f5b301;
    display: flex;
    align-items: center;
    gap: 0.3em;
}
.book-rating .rating-count {
    color: var(--text-secondary);
}
.book-rating--empty {
    color: var(--text-secondary);
    font-style: italic;
}

/* Book detail page rating summary (under the title/author) */
.book-rating-summary {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
    margin: 0.25rem 0 0.75rem 0;
    font-size: 0.95rem;
}
.book-rating-summary .rating-stars {
    color: #f5b301;
    letter-spacing: 0.05em;
}
.book-rating-summary .rating-value {
    font-weight: 600;
    color: var(--text-primary);
}
.book-rating-summary .rating-count-link {
    color: var(--text-secondary);
    text-decoration: none;
}
.book-rating-summary .rating-count-link:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

/* Library list row rating */
.lib-item-rating {
    color: #f5b301;
    white-space: nowrap;
}

/* "Updated X ago" badge on discovery cards */
.book-updated {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.3em;
    padding: 0 0.5rem;
}

/* ==========================================================================
   Responsive / mobile
   ========================================================================== */
@media (max-width: 768px) {
    .container { padding: 0.8rem 1rem; }

    /* Collapsible header */
    .header-container { flex-wrap: wrap; padding: 0 1rem; gap: 0; }
    .header-bar { flex: 1 1 100%; justify-content: space-between; }
    .nav-toggle { display: inline-flex; align-items: center; }
    .site-nav {
        flex: 1 1 100%;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: 0.5rem 0 0.25rem;
    }
    .site-header.nav-open .site-nav { display: flex; }
    .header-left, .header-right { flex-direction: column; align-items: stretch; gap: 0.25rem; width: 100%; }
    .user-nav { flex-direction: column; align-items: stretch; gap: 0.25rem; width: 100%; }
    .main-nav-link { padding: 0.75rem 0.6rem; border-radius: 6px; }
    .user-nav .logout-link, .user-nav .signup-link { text-align: center; }
    .theme-toggle-button { align-self: flex-start; margin: 0.25rem 0 0; }

    /* Headings */
    h1, .book-info-container h1 { font-size: 1.6rem; }

    /* Book grid */
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; }
    .book-item .title { font-size: 0.85rem; }

    /* Homepage shelves */
    .shelf-scroll { gap: 0.8rem; }
    .shelf-scroll .book-item { flex-basis: 130px; }

    /* Book detail: stack cover above info, centered */
    .book-details-layout { gap: 1.2rem; }
    .book-cover-container { flex: 0 0 auto; width: 60%; max-width: 200px; margin: 0 auto; }
    .book-info-container { flex: 1 1 100%; }

    /* Chapter reader */
    .chapter-content { padding: 1rem 1.1rem; }
    .chapter-navigation { gap: 0.5rem; }

    /* Comments: cap indentation so deep threads stay on screen */
    .comment-item { padding: 1rem; gap: 0.7rem; }
    .comment-reply { margin-left: calc(min(var(--indent-level, 1), 3) * 0.8rem); padding-left: 0.7rem; }
    .comment-avatar .avatar-image, .review-avatar .avatar-image { width: 36px; height: 36px; }

    /* Tap targets + prevent iOS zoom-on-focus */
    button, .button, .button-link { min-height: 40px; }
    input, textarea, select { font-size: 16px; }
}

@media (max-width: 420px) {
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.7rem; }
    .book-cover-container { width: 75%; }
    .shelf-scroll .book-item { flex-basis: 110px; }
}

/* Chapter list heading with the "Refresh" action */
.chapter-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.chapter-list-heading h2 { margin: 0; margin-right: auto; }
.refresh-chapters-form { margin: 0; }
.refresh-chapters-button { display: inline-flex; align-items: center; gap: 0.4em; }
.rss-button { display: inline-flex; align-items: center; gap: 0.4em; text-decoration: none; }

/* Profile sharing/RSS settings */
.privacy-form { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.privacy-form .privacy-state { color: var(--text-secondary); font-size: 0.88rem; }
.feed-url-input { width: 100%; max-width: 560px; padding: 0.5rem 0.7rem; font-size: 0.85rem; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-secondary); border-radius: 5px; }

/* Library "new chapters" badge in the header */
.nav-badge { display: inline-block; margin-left: 0.35em; padding: 0.05em 0.5em; min-width: 1.1em; text-align: center; background-color: var(--accent-color); color: #fff; border-radius: 10px; font-size: 0.72em; font-weight: 700; vertical-align: text-top; }

/* Linked usernames on comments/reviews */
.comment-author, .review-author { text-decoration: none; }
a.comment-author:hover, a.review-author:hover { color: var(--accent-color); text-decoration: underline; }
