/* ==========================================================================
   1. CONFIGURATION - Fonts & Themes
   ========================================================================== */

/* --- Font Families --- */
:root {
    --font-body: 'Verdana', 'Verdana', sans-serif;
    --font-heading: 'Verdana', serif;
}

/* --- Theme Color Palettes --- */
/* Base variables (always apply) */
:root {
    --font-body: 'Verdana', sans-serif;
    --font-heading: 'Verdana', serif;
}

/* SEPIA */
[data-theme="sepia"] {
    --bg-color: #f5eeda;
    --text-color: #5b4636;
    --primary-bg: #efe8d8;
    --border-color: #d3c0a5;
    --header-color: #4a3728;
    --accent-color: #8c7853;
    --accent-text-color: #f5eeda;
    --hover-color: #5b4636;
    --subtle-text-color: #8c7853;
    --book-header-color: #695032;
    --topnav: #efe8d8;
}

/* LIGHT */
[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #212922;
    --primary-bg: #f8faf8;
    --border-color: #dee2e6;
    --header-color: #0c611e;
    --accent-color: #5eac85;
    --accent-text-color: #181818;
    --hover-color: #38a13d;
    --subtle-text-color: #798a78;
    --book-header-color: #c1c1c1;
    --topnav: #ebf7ee;
}

/* DARK */
[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #ffffff;
    --primary-bg: #1e1e1e;
    --border-color: #444444;
    --header-color: #ffffff;
    --accent-color: #47385a;
    --accent-text-color: #ffffff;
    --hover-color: #311e47;
    --subtle-text-color: #a0a0a0;
    --book-header-color: #000000;
    --topnav: #1e1e1e;
}


/* ==========================================================================
   2. BASE & LAYOUT STYLES
   ========================================================================== */
body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.links {
    color: #5b4636;
    font-weight: bold;
    text-decoration: none;
}

.links:hover {
    text-decoration: underline;
}

footer a {
    color: #5b4636;
    font-weight: bold;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--subtle-text-color);
    background-color: var(--primary-bg);
    font-size: 0.9rem;
    border-top: 2px solid var(--border-color);
}

/* Main container for two-column layout */
.container {
    display: flex;
    padding: 2rem;
    gap: 2rem;
    flex-grow: 1;
}

/* Left Section (Info) */
.left-section {
    flex: 1;
    padding: 2rem;
    background-color: var(--primary-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.left-section h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--header-color);
    margin-top: 0;
}

/* Right Section (Content) */
.right-section {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.carousel {
  width: 90%;
  height: 510px;
  margin: auto;
  overflow: hidden;
  position: relative;
  background: var(--border-color);
  display: flex; 
  align-items: center;
}

.carousel-track {
  display: flex;
  transition: transform 0.6s ease-in-out;
}

/* Dots */
.dots {
  text-align: center;
  margin-top: 10px;
}

.dot {
  height: 10px;
  width: 10px;
  margin: 0 4px;
  background-color: #bbb;
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
  transition: background-color 0.3s;
}

.slide {
    width:100%;
  height: 200px;
  flex-shrink: 0;
    border: 2px solid var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 40px;
  font-weight: bold;
  color: white;
}


.dot.active {
  background-color: #333;
}

.action-box {
    background-color: var(--primary-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-left: 1%;
    margin-top: 10px;
    margin-right: 1%;
    margin-bottom: 10px;
}

.book-list-container {
    background-color: var(--primary-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
h2, h3 {
    font-family: var(--font-heading);
    color: var(--header-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 0;
}

/* Form Elements */
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"], select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: var(--font-body);
    box-sizing: border-box;
    background-color: var(--bg-color);
    color: var(--text-color);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Wrapper for custom select arrow */
.select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--text-color); /* Arrow color */
    pointer-events: none; /* Allows clicking through the arrow */
}

/* Grid for form options */
.form-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
    align-items: end;
}

/* Custom Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
}
.checkbox-wrapper input[type="checkbox"] {
    opacity: 0; /* Hide the default checkbox */
    position: absolute;
}
.checkbox-wrapper label {
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
}
.checkbox-wrapper label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 4px;
}
.checkbox-wrapper input[type="checkbox"]:checked + label::after {
    content: '✔';
    position: absolute;
    left: 5px;
    top: -1px;
    font-size: 18px;
    color: var(--text-color);
}

.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: var(--accent-text-color);
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: var(--hover-color);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}
.btn-danger:hover {
    background-color: #c82333;
}

/* Book List Styling */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.book-item {
    text-align: center;
}

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

.book-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: contain;
    border-radius: 4px;
    border: 3px solid var(--border-color);
    margin-bottom: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-item a:hover img {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.book-item h3 {
    margin: 0.5rem 0 0.2rem 0;
    font-size: 1rem;
}

.book-item p {
    font-size: 0.85rem;
    color: var(--subtle-text-color);
    margin: 0;
}

/* Book List (replaces grid on index) */
.book-list-item {
    text-align: center;
}

.book-list-item a {
    text-decoration: none;
    color: var(--text-color);
    display: block;
}

.book-list-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: contain;
    border-radius: 4px;
    border: 3px solid var(--border-color);
    margin-bottom: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-list-item a:hover img {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.book-list-item-info h3 {
    margin: 0.5rem 0 0.2rem 0;
    font-size: 1rem;
    border: none;
}

.book-list-item-info p {
    font-size: 0.85rem;
    color: var(--subtle-text-color);
    margin: 0;
}

.book-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    font: inherit;
}




.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.token-estimate {
    font-style: italic;
    color: var(--subtle-text-color);
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Book Info Page */
.book-info-layout {
    display: flex;
    gap: 2rem;
}
.book-cover {
    flex-basis: 250px;
}
.book-cover img {
    width: 100%;
    border-radius: 4px;
    border: 3px solid var(--border-color);
}
.book-details {
    flex-grow: 1;
}
.book-details .genre-tag {
    display: inline-block;
    background: var(--border-color);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.book-details .actions {
    margin-top: 2rem;
}

/* Read Book Page */
.read-book-header {
    background-color: var(--book-header-color);
    color: var(--accent-text-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.read-book-header h1 {
    margin: 0;
    font-size: 1.5rem;
}
.read-book-header .author {
    font-style: italic;
    opacity: 0.8;
}
.read-book-content {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 2rem;
    font-size: 1.2rem;
    line-height: 1.8;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 1000;
    font-size: 1.5rem;
}

/* My Account Page Layout */
.account-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start; /* Align items to the top */
}
.borrowed-list {
    flex: 1;
    max-height: 60vh; /* Set a max height */
    overflow-y: auto; /* Enable vertical scrolling */
    padding-right: 1rem; /* Add some space for the scrollbar */
}
.settings {
    flex: 1;
    position: sticky; /* Make settings stick to the top of the container */
    top: 0;
}
.settings-group {
    margin-top: 2rem;
}
.settings-group label {
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
}



/* Profile Header on Account Page */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}
.profile-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
}
.profile-info h3 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1.8rem;
}
.profile-info p {
    margin: 0.2rem 0 1rem 0;
    color: var(--subtle-text-color);
}
.random-book-feature {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.random-book-card {
    display: flex;
    gap: 1rem;
    text-decoration: none;
    color: var(--text-color);
    padding: 1rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.random-book-card:hover {
    background-color: var(--bg-color);
}
.random-book-card img {
    width: 80px;
    height: 120px;
    object-fit: contain;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}
.random-book-info h4 {
    margin: 0 0 0.5rem 0;
    padding: 0;
    border: none;
    font-family: var(--font-heading);
}
.profile-actions {
    display: flex;
    gap: 0.5rem;
    align-items: stretch; /* Ensures buttons have the same height */
}

.book-list-item-info h4 { border-bottom: none; margin: 0; padding: 0; font-family: var(--font-heading); color: var(--header-color); }

/* Auth Separator */
.auth-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--subtle-text-color);
}
.auth-separator::before, .auth-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}
.auth-separator span {
    padding: 0 10px;
    font-size: 0.9rem;
}
.arrow {
  border: solid black;
  border-width: 0 3px 3px 0;
  display: inline-block;
  padding: 3px;
}

.right-arrow {
  transform: rotate(-45deg);
  transform: translateY(-25px);
  -webkit-transform: rotate(-45deg);
}

/* The Modal (background) */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 100px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
  position: relative;
  background-color: #fefefe;
  margin: auto;
  padding: 0;
  border: 1px solid #888;
  width: 80%;
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
  -webkit-animation-name: animatetop;
  -webkit-animation-duration: 0.4s;
  animation-name: animatetop;
  animation-duration: 0.4s
}

/* Add Animation */
@-webkit-keyframes animatetop {
  from {top:-300px; opacity:0} 
  to {top:0; opacity:1}
}

@keyframes animatetop {
  from {top:-300px; opacity:0}
  to {top:0; opacity:1}
}

/* The Close Button */
.close {
  color: var(--text-color);
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: var(--header-color);
  text-decoration: none;
  cursor: pointer;
}

.show-more {
    text-decoration: none;
    color: var(--hover-color);
}

.show-more:hover {
    color: var(--header-color);
}

/* ==========================================================================
   3. NEW NAVIGATION STYLES
   ========================================================================== */

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem; /* Side margins */
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-color);
    padding: 10px 20px 10px 20px;
}

.nav-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-main .brand {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--header-color);
    text-decoration: none;
}

.nav-main .nav-links {
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-main .nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1rem;
    padding: 1.5rem 0;
    position: relative;
    transition: color 0.2s ease;
}

.nav-main .nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--header-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-main .nav-links a:hover,
.nav-main .nav-links a.active {
    color: var(--header-color);
}

.nav-main .nav-links a:hover::after,
.nav-main .nav-links a.active::after {
    transform: scaleX(1);
}

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

.nav-user .login-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
    position: relative;
    padding: 1.5rem 0;
}

.nav-user .login-link:hover {
    color: var(--header-color);
}

.nav-user .login-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--header-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-user .login-link:hover::after {
    transform: scaleX(1);
}

.nav-user .profile-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-color);
}

.nav-user .profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.nav-user .user-email {
    font-size: 0.9rem;
    display: none; /* Hidden on smaller screens */
}

@media (min-width: 768px) {
    .nav-user .user-email {
        display: block; /* Shown on larger screens */
    }
}

/* ==========================================================================
   4. NEW INDEX PAGE LAYOUT
   ========================================================================== */

body > .container {
    display: block; /* Override flex for the main container */
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.main-content {
    width: 100%;
}

.featured-books {
    margin-bottom: 3rem;
}

.featured-books h2 {
    font-size: 2rem;
    text-align: center;
    border-bottom: none;
    margin-bottom: 2rem;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.featured-book-card {
    background-color: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.featured-book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.featured-book-card .card-image img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    float: left;
}

.featured-book-card .card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    float:right;
}

.featured-book-card .card-content h3 {
    font-size: 1.4rem;
    margin: 0 0 0.5rem 0;
    border: none;
    padding: 0;
}

.featured-book-card .card-content .author {
    color: var(--subtle-text-color);
    margin-bottom: 1rem;
}

.featured-book-card .card-content .genre-tag {
    align-self: flex-start;
    background-color: var(--accent-color);
    color: var(--accent-text-color);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    margin-top: auto; /* Pushes the genre to the bottom */
}

.category-row .book-list-item img {
    height: 220px; /* Taller images for genre rows */
}

.category-row h2 a {
    text-decoration: none;
    color: var(--header-color);
}

/* ==========================================================================
   5. FOOTER & SITEMAP
   ========================================================================== */

.sitemap {
    display: flex;
    justify-content: center;
    gap: 4rem;
    padding: 2rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sitemap-col h3 {
    font-family: var(--font-heading);
    color: var(--header-color);
    font-size: 1.2rem;
    border-bottom: none;
    margin-bottom: 1rem;
}

.sitemap-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sitemap-col ul li {
    margin-bottom: 0.5rem;
}

.sitemap-col ul a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.2s ease;
}

.sitemap-col ul a:hover {
    color: var(--header-color);
}

/* ==========================================================================
   Carousel Item adjustments
   ========================================================================== */

.featured-book-card {
    flex-direction: row;
    height: 100%;
}

.featured-book-card .card-image {
    flex-basis: 40%; /* 40% of the card for the image */
    flex-shrink: 0;
}

.featured-book-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.featured-book-card .card-content {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Pushes title to top, synopsis to bottom */
    text-align: center;
}

.featured-book-card .card-content h3 {
    margin: 0;
    font-size: 1.8rem;
    align-self: center; /* Center horizontally in flex column */
}

.featured-book-card .card-content .synopsis {
    font-size: 1rem;
    color: var(--subtle-text-color);
    margin-top: 1rem; /* Space between title and synopsis */
}

/* Override slide styles for better layout */
.slide {
    display: flex;
    align-items: stretch; /* Make children fill the height */
    justify-content: center;
    padding: 20px; /* Add some padding around the card */
    box-sizing: border-box;
}

.featured-book-card .card-content .author,
.featured-book-card .card-content .genre-tag {
    display: none; /* Hide author and genre as per new design */
}

/* ah yes, the classic 1010 line css file*/
.genre-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-bg);
    padding: 20px;
    text-align:center;
}

.genre-card-books {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background-color: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    min-height: 320px; /* Set a minimum height for uniform card size */
}

.genre-card-books a {
    text-decoration: none;
}

.genre-card-books h3 {
    border-bottom: none;
    margin-bottom: 1rem;
}

.books-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    width: 100%;
}

.books-container .book-list-item {
    width: 120px; /* Set a fixed width for the book items */
}
/* ==========================================================================
   6. GENRE CAROUSEL STYLES
   ========================================================================== */

.genre-section {
    margin-bottom: 3rem;
}

.genre-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    text-align: center;
}

.genre-header h2 {
    font-size: 1.8rem;
    margin: 0;
    border: none;
}

.genre-header h2 a {
    text-decoration: none;
    color: var(--header-color);
    transition: color 0.2s ease;
}

.genre-header h2 a:hover {
    color: var(--accent-color);
}

.genre-controls {
    display: none;
}

.genre-carousel-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    margin: 0 auto;
}

.prev-btn,
.next-btn {
    display: none;
    background-color: var(--primary-bg);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 0.8rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 50px;
    text-align: center;
}

.prev-btn:hover,
.next-btn:hover {
    background-color: var(--accent-color);
    color: var(--accent-text-color);
    border-color: var(--accent-color);
}

.book-carousel-container {
    width: 100%;
    height: auto;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 0.5rem 0;
}

/* Hide default scrollbar but keep functionality */
.book-carousel-container::-webkit-scrollbar {
    height: 8px;
}

.book-carousel-container::-webkit-scrollbar-track {
    background: var(--primary-bg);
}

.book-carousel-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.book-carousel-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.book-carousel {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: nowrap;
    width: auto;
    min-width: 100%;
}

.book-card {
    flex: 0 0 220px; /* Do not grow, do not shrink, base width of 220px */
    text-decoration: none;
    color: var(--text-color);
    display: block;
    transition: transform 0.2s ease;
}

.book-card:hover {
    transform: translateY(-5px);
}

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

.book-card .book-cover {
    width: 100%;
    height: 330px;
    object-fit: contain;
    border-radius: 4px;
    border: 3px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.book-card .book-info h4 {
    margin: 0.5rem 0 0.2rem 0;
    font-size: 1rem;
    border: none;
    padding: 0;
}

.book-card .book-info p {
    font-size: 0.85rem;
    color: var(--subtle-text-color);
    margin: 0;
}

/* ==========================================================================
   Recently Added Books Section
   ========================================================================== */

.recent-books {
    margin: 3rem auto;
    padding: 0 2rem;
    max-width: 1200px;
    width: 100%;
}

.recent-books h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--header-color);
}

.recent-books-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.recent-book-card {
    display: flex;
    flex-direction: row;
    background-color: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
}

.recent-book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-color);
}

.recent-book-card a {
    display: flex;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.recent-book-image {
    flex-shrink: 0;
    width: 120px;
    height: 180px;
    overflow: hidden;
}

.recent-book-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.recent-book-info {
    flex-grow: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.recent-book-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--text-color);
    line-height: 1.3;
}

.recent-book-info .author {
    font-size: 0.9rem;
    color: var(--subtle-text-color);
    margin: 0.25rem 0;
    font-style: italic;
}

.recent-book-info .genre {
    font-size: 0.85rem;
    color: var(--accent-color);
    margin: 0.5rem 0 0 0;
    font-weight: 600;
}

/* Responsive: Stack on smaller screens */
@media (max-width: 768px) {
    .recent-books-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .recent-book-image {
        width: 100px;
        height: 150px;
    }

    .recent-book-info {
        padding: 1rem;
    }

    .recent-books h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
}

/* ==========================================================================
   Sitemap Page
   ========================================================================== */

.sitemap-header {
    text-align: center;
    margin: 2rem 0 3rem 0;
    padding: 2rem;
    background-color: var(--primary-bg);
    border-radius: 8px;
}

.sitemap-header h1 {
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
    color: var(--header-color);
}

.sitemap-header p {
    font-size: 1.1rem;
    color: var(--subtle-text-color);
    margin: 0;
}

.sitemap-container {
    margin: 0 auto 3rem auto;
    max-width: 1000px;
    padding: 0 2rem;
}

.sitemap-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.sitemap-section {
    background-color: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.sitemap-section:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.sitemap-section h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
}

.sitemap-section h2 a {
    color: var(--header-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sitemap-section h2 a:hover {
    color: var(--accent-color);
}

.sitemap-section p {
    margin: 0;
    color: var(--subtle-text-color);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .sitemap-header h1 {
        font-size: 2rem;
    }

    .sitemap-nav {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .sitemap-section {
        padding: 1rem;
    }
}















#book-wrapper {
    max-width: 900px;
    margin: auto;
}

#book-canvas {
    width: 100%;
    display: block;
    background: #f6ecd8;
    box-shadow: 0 15px 30px rgba(0,0,0,.25);
}

.book-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
}

.book-controls button {
    padding: .6rem 1.4rem;
    font-size: 1rem;
    cursor: pointer;
}

#page-input {
    width: 70px;
}