body {
    font-family: 'Playfair Display', serif;
    margin: 0;
    color: #3a2c1f;
    overflow-x: hidden;
}

header, footer {
    background-color: #5b4636;
    color: #fffdf8;
    padding: 1rem 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    width: 100%;
    box-sizing: border-box; 
}

footer {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
}

header h1 {
    margin: 0;
    font-weight: 700;
    font-size: clamp(1.8rem, 5vw, 2.5rem); /* Responsive font size */
}

header p {
    margin: 0.5rem 0 0;
    opacity: 0.8;
    color: #FFD700;
}

main {
    transition: margin-left 0.5s;
    padding: 1rem;
    background: linear-gradient(135deg, #ede0c8, #d6c2a1);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 120px);
}

/* ----- SIDENAV ----- */

.sidenav {
    height: 100%;
    min-height: 100vh;
    width: 0;
    position: fixed;
    z-index: 2;
    top: 0;
    left: 0;
    background-color:#6b5843;
    overflow-x: hidden;
    transition: width 0.5s ease;
    padding-top: 60px;
}

.sidenav ul {
    list-style: none;
    padding: 0 0 1rem 0;
    margin: 0;
    display: block;
}

.sidenav ul li {
    margin: 0.5rem 0;
}

.sidenav ul li a {
    color: #f5e4c3;
    text-decoration: none;
    padding: 0.5rem 1rem;
    display: block;
    transition: background-color 0.3s;
    font-weight: 500;
}

.sidenav ul li:last-child {
    margin-bottom: 5rem;
}

.sidenav ul li a:hover,
.sidenav ul li a:focus {
    background-color: #8b5e3c;
    outline: none;
}

.sidenav .closebtn {
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 36px;
    color: #fffdf8;
    text-decoration: none;
}

.sidenav .closebtn:focus {
    outline: 2px solid #fffdf8;
}

.openbtn {
    font-size: 1.25rem;
    cursor: pointer;
    background-color: #a67843;
    color: #fffdf8;
    padding: 10px 15px;
    border: none;
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1;
    transition: background-color 0.3s;
    border-radius: 6px;
}

.openbtn:hover,
.openbtn:focus {
    background-color: #8b5e3c;
    outline: none;
}

.book-section {
    margin-bottom: 2rem;
    width: 100%;
    max-width: 1200px;
    padding: 0 1rem;
}

.book-section h2 {
    color: #5b4636;
    margin-top: 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #d4a017;
    text-align: center;
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.book-section p {
    margin: 0.5rem 0 1rem;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: #4b3b2a;
    text-align: center;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 200px));
    gap: 1rem;
    width: 100%;
    max-width: 1200px;
    justify-content: center;
}

.book-card {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    background-color: #fffdf8;
    border: 1px solid #e0d6c3;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    max-width: 200px;
    width: 100%;
    position: relative;
}

.book-card:hover,
.book-card:focus-within {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.book-card img {
    width: 100%;
    height: auto;
    display: block;
    border-bottom: 1px solid #333;
    object-fit: cover;
    aspect-ratio: 2/3;
}

.overview {
    background-color: #fffdf8;
    color: #3a2c1f;
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: 100%;
    transform: translateY(101%);
    transition: transform 0.3s ease-in;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 0.5rem;
}

.book-card:hover .overview,
.book-card:focus-within .overview {
    transform: translateY(0);
}

.overview h3 {
    margin-bottom: 0;
    padding: 0.5rem;
    width: 100%;
}

.overview p {
    margin: 0;
    padding: 0.5rem;
}

#scrollToTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    border: none;
    outline: none;
    background-color: #a67843;
    color: white;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(166, 120, 67, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scrollToTopBtn:hover,
#scrollToTopBtn:focus {
    background-color: #8b5e3c;
    box-shadow: 0 6px 15px rgba(139, 94, 60, 0.4);
    transform: translateY(-2px);
    outline: none;
}

#scrollToTopBtn svg {
    width: 24px;
    height: 24px;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .book-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 180px));
    }

    .book-card {
        max-width: 180px;
    }

    .book-section {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }

    header p {
        font-size: clamp(0.9rem, 2.5vw, 1rem);
    }

    main {
        padding: 0.5rem;
    }

    .book-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 160px));
        gap: 1rem;
    }

    .book-card {
        max-width: 160px;
        min-height: 250px;
    }

    .book-card p {
        font-size: clamp(0.8rem, 2vw, 0.9rem);
    }

    .openbtn {
        top: 10px;
        left: 10px;
        padding: 8px 12px;
        font-size: 1rem;
    }

    .sidenav {
        padding-top: 50px;
    }

    .sidenav .closebtn {
        font-size: 30px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1rem 0.5rem;
    }

    header h1 {
        font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    }

    header p {
        font-size: clamp(0.8rem, 2vw, 0.9rem);
    }

    .book-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 140px));
        gap: 0.75rem;
    }

    .book-card {
        max-width: 140px;
        min-height: 200px;
    }

    .book-card img {
        aspect-ratio: 3/4;
    }

    .book-section h2 {
        font-size: clamp(1.2rem, 3vw, 1.5rem);
    }

    #scrollToTopBtn {
        width: 40px;
        height: 40px;
        bottom: 15px;
        right: 15px;
    }

    #scrollToTopBtn svg {
        width: 20px;
        height: 20px;
    }
}

.rating-1 {
    background-color: #DC2626;  /* Deep red */
    color: #FFFFFF;
}

.rating-2 {
    background-color: #EF4444;  /* Bright red */
    color: #FFFFFF;
}

.rating-3 {
    background-color: #F87171;  /* Light red */
    color: #FFFFFF;
}

.rating-4 {
    background-color: #F97316;  /* Orange red */
    color: #FFFFFF;
}

.rating-5 {
    background-color: #F59E0B;  /* Amber */
    color: #000000;
}

.rating-6 {
    background-color: #EAB308;  /* Yellow */
    color: #000000;
}

.rating-7 {
    background-color: #84CC16;  /* Lime green */
    color: #000000;
}

.rating-8 {
    background-color: #4ADE80;  /* Emerald green */
    color: #000000;
}

.rating-9 {
    background-color: #22C55E;  /* Medium green */
    color: #000000;
}

.rating-10 {
    background-color: #16A34A;  /* Deep green */
    color: #FFFFFF;
}