/* Body & font applied to a class */
.app-body {
    font-family: 'Merriweather', serif !important;
    letter-spacing: 0.3px;
}

/* Book card styles */
.book-card {
    transition: transform .3s, box-shadow .3s;
    cursor: pointer;
}
.book-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.25);
}
.book-img-box {
    height: 320px; /* slightly bigger for desktop */
    background: #fafafa; /* light mode */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid #efefef;
}

/* Large tablets & medium screens */
@media (max-width: 992px) {
    .book-img-box {
        height: 280px; /* a bit smaller */
    }
}

/* Small tablets / large phones */
@media (max-width: 768px) {
    .book-img-box {
        height: 240px;
    }
}

/* Small mobile phones */
@media (max-width: 576px) {
    .book-img-box {
        height: 200px;
    }
}


/* Dark mode for book card image box */
:root[data-bs-theme="dark"] .book-img-box {
    background-color: #313A46; /* dark mode background */
    border-bottom: 1px solid #444;
}


.book-img-box img {
    height: 100%;
    width: auto;
    object-fit: contain;
}
.card-title {
    font-weight: 700;
    font-size: 1.15rem;      /* slightly bigger for emphasis */
    letter-spacing: 0.5px;
    line-height: 1.3;
    margin-bottom: 0.4rem;
}
.card-subtitle {
    font-size: .9rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}
.info-line {
    font-size: 0.95rem;      /* readable size */
    letter-spacing: 0.3px;
    line-height: 1.5;
    margin-bottom: 3px;
}
.view-btn {
    font-size: .85rem;
    letter-spacing: .5px;
    padding: 6px 14px;
}

/* Tabs - common styles */

/* Light mode (default) */
.subject-tabs-wrapper .nav-link {
    background-color: #f8f9fa; /* light background */
    color: #333399; /* text color */
    border-radius: 50px;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.subject-tabs-wrapper .nav-link.active {
    background-color: #333399;
    color: #fff;
}

/* Hover effect */
.subject-tabs-wrapper .nav-link:hover {
    background-color: #333399;
    color: #fff;
}

/* Dark mode */
:root[data-bs-theme="dark"] .subject-tabs-wrapper .nav-link {
    background-color: #313A46; /* dark background */
    color: #ffffff;
}

:root[data-bs-theme="dark"] .subject-tabs-wrapper .nav-link.active {
    background-color: #D4AF37; /* gold for active tab */
    color: #313A46; /* text dark on gold */
}

:root[data-bs-theme="dark"] .subject-tabs-wrapper .nav-link:hover {
    background-color: #D4AF37; /* gold hover */
    color: #313A46;
}

/* Icon color adjustment */
.subject-tabs-wrapper .nav-link i {
    vertical-align: middle;
}

/* Spacing / responsive adjustments */
@media (max-width: 768px) {
    .subject-tabs-wrapper .nav-link {
        font-size: 0.95rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 576px) {
    .subject-tabs-wrapper .nav-link {
        font-size: 0.9rem;
        padding: 0.35rem 0.6rem;
    }
}

.nav-pills .nav-link {
    white-space: nowrap;
    color: #333;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 50px;
    padding: 8px 20px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Active tab */
.nav-pills .nav-link.active {
    background-color: #4a90e2;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Hover for non-active tab */
.nav-pills .nav-link:not(.active):hover {
    background-color: #e6f0ff;
    color: #4a90e2;
    transform: translateY(-2px);
}

/* Subject text styling inside tabs if needed */
.subject-text {
    display: block;
    line-height: 1.2;
}

/* Desktop: show all tabs, wrap if needed */
@media (min-width: 992px) {
    .subject-tabs-wrapper ul {
        display: flex;
        flex-wrap: wrap; /* wrap if too many subjects */
        overflow-x: visible;
        justify-content: flex-start;
    }
}

/* Tablet & Mobile: horizontal scroll for tabs */
@media (max-width: 991px) {
    .subject-tabs-wrapper ul {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }

    /* Hide scrollbar for Chrome, Safari and Opera */
    .subject-tabs-wrapper ul::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
        background: transparent;
    }

    .nav-pills .nav-item {
        flex: 0 0 auto; /* auto-width pills */
        margin-right: 8px;
    }

    .nav-pills .nav-link {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
}

.book-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    }
    .book-loader.active {
    opacity: 1;
    visibility: visible;
    }

    /* Book core */
    .book,
    .book__pg-shadow,
    .book__pg {
    animation: cover 5s ease-in-out infinite;
    }

    .book {
    background-color: hsl(268, 90%, 65%);
    border-radius: 0.25em;
    box-shadow: 0 0.25em 0.5em hsla(0, 0%, 0%, 0.3),
                0 0 0 0.25em hsl(278, 100%, 57%) inset;
    padding: 0.25em;
    perspective: 37.5em;
    position: relative;
    width: 8em;
    height: 6em;
    transform-style: preserve-3d;
    }

    .book__pg-shadow,
    .book__pg {
    position: absolute;
    left: 0.25em;
    width: calc(50% - 0.25em);
    }

    .book__pg-shadow {
    animation-name: shadow;
    background-image: linear-gradient(-45deg, transparent 50%, hsla(0, 0%, 0%, 0.3) 50%);
    filter: blur(0.25em);
    top: calc(100% - 0.25em);
    height: 3.75em;
    transform: scaleY(0);
    transform-origin: 100% 0%;
    }

    .book__pg {
    animation-name: pg1;
    background-color: hsl(223, 10%, 100%);
    background-image: linear-gradient(90deg, transparent 87.5%, hsl(223, 10%, 90%));
    height: calc(100% - 0.5em);
    transform-origin: 100% 50%;
    }

    .book__pg--2,
    .book__pg--3,
    .book__pg--4 {
    background-image: repeating-linear-gradient(hsl(223, 10%, 10%) 0 0.125em, transparent 0.125em 0.5em),
                        linear-gradient(90deg, transparent 87.5%, hsl(223, 10%, 90%));
    background-repeat: no-repeat;
    background-position: center;
    background-size: 2.5em 4.125em, 100% 100%;
    }

    .book__pg--2 { animation-name: pg2; }
    .book__pg--3 { animation-name: pg3; }
    .book__pg--4 { animation-name: pg4; }
    .book__pg--5 { animation-name: pg5; }

    /* --- Keyframes --- */
    @keyframes cover {
    from, 5%, 45%, 55%, 95%, to { background-color: hsl(278, 84%, 67%); }
    10%, 40%, 60%, 90% { background-color: hsl(271, 90%, 45%); }
    }
    @keyframes shadow {
    from, 10.01%, 20.01%, 30.01%, 40.01% { transform: scaleY(0) rotateY(0); }
    5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { transform: scaleY(0.2) rotateY(90deg); }
    10%, 20%, 30%, 40%, 50%, to { transform: scaleY(0) rotateY(180deg); }
    }
    @keyframes pg1 {
    0%, 5% { transform: rotateY(0deg); }
    15%, 20% { transform: rotateY(-180deg); }
    25%, to { transform: rotateY(-180deg); }
    }
    @keyframes pg2 {
    0%, 15% { transform: rotateY(0deg); }
    25%, 30% { transform: rotateY(-180deg); }
    35%, to { transform: rotateY(-180deg); }
    }
    @keyframes pg3 {
    0%, 25% { transform: rotateY(0deg); }
    35%, 40% { transform: rotateY(-180deg); }
    45%, to { transform: rotateY(-180deg); }
    }
    @keyframes pg4 {
    0%, 35% { transform: rotateY(0deg); }
    45%, 50% { transform: rotateY(-180deg); }
    55%, to { transform: rotateY(-180deg); }
    }
    @keyframes pg5 {
    0%, 45% { transform: rotateY(0deg); }
    55%, 60% { transform: rotateY(-180deg); }
    65%, to { transform: rotateY(-180deg); }
}

#clearSearch:hover {
    color: #555;
}

/* slider new arrival */

.new-arrivals-section .slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.new-arrivals-slider {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 5px 0;
}

.new-arrivals-slider::-webkit-scrollbar {
    display: none;
}

/* Mobile: Show 1 card */
.new-arrivals-slider .book-card {
    flex: 0 0 calc(100% - 10px);
    max-width: calc(100% - 10px);
    box-sizing: border-box;
    scroll-snap-align: start;
    margin: 0 5px;
}

/* Tablet: Show 2 cards (≥ 768px) */
@media (min-width: 768px) {
    .new-arrivals-slider .book-card {
        flex: 0 0 calc(50% - 12px);
        max-width: calc(50% - 12px);
    }
}

/* Desktop: Show 3 cards (≥ 992px) */
@media (min-width: 992px) {
    .new-arrivals-slider .book-card {
        flex: 0 0 calc(33.333% - 10px);
        max-width: calc(33.333% - 10px);
    }
}

/* Large Desktop: Show 4 cards (≥ 1200px) */
@media (min-width: 1200px) {
    .new-arrivals-slider .book-card {
        flex: 0 0 calc(25% - 12px);
        max-width: calc(25% - 12px);
    }
}

/* Book image container */
.book-img-box {
    height: 300px;
    overflow: hidden;
}

@media (max-width: 767px) {
    .book-img-box {
        height: 180px; /* Slightly smaller on mobile */
    }
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.slider-arrow:hover {
    background: rgba(0,0,0,0.9);
}

/* Hide arrows on mobile when not needed */
@media (max-width: 767px) {
    .slider-arrow {
        width: 35px;
        height: 35px;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

.left-arrow { 
    left: 5px; 
}
.right-arrow { 
    right: 5px; 
}

@media (min-width: 768px) {
    .left-arrow { left: 10px; }
    .right-arrow { right: 10px; }
}

.section-header {
    font-family: 'Merriweather', serif;
    font-size: 1.8rem;
    letter-spacing: 1px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #333399; /* Default color for light mode */
    transition: color 0.3s;
}

:root[data-bs-theme="dark"] .section-header {
    color: #ffffff !important;
}

:root[data-bs-theme="dark"] .book-img-container {
    background-color: #313A46 !important;
}

.section-header i {
    font-size: 1.5rem;
    color: #ff6b6b;
}
/* Container for book image */
.book-img-container {
    width: 100%;
    height: 260px; /* Default desktop height */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #efefef;
}

/* Book image */
.book-img {
    max-height: 100%;   /* Don't exceed container height */
    max-width: 100%;    /* Don't exceed container width */
    object-fit: contain; /* Entire image visible, maintains aspect ratio */
}

/* Placeholder for missing images */
.book-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    padding: 10px;
}

/* Mobile height */
@media (max-width: 767px) {
    .book-img-container {
        height: 180px;
    }
}

/* Tablet height */
@media (min-width: 768px) and (max-width: 991px) {
    .book-img-container {
        height: 220px;
    }
}

/* Header Of Library Section Header Styles */
/* ===============================
   LIGHT / DARK MODE COLORS
   =============================== */
:root[data-bs-theme="light"] .library-title {
    color: #333399 !important;
}

:root[data-bs-theme="light"] .library-subtitle {
    color: #555 !important;
}

:root[data-bs-theme="dark"] .library-title {
    color: #ffffff !important;
}

:root[data-bs-theme="dark"] .library-subtitle {
    color: #cccccc !important;
}

/* ===============================
   BASE STYLES
   =============================== */
.library-header-block {
    width: 100%;
    text-align: center;
    padding-bottom: 12px;
    position: relative;
    cursor: default;
}

/* Inner wrapper = actual width of text */
.library-header-inner {
    display: inline-block;
    position: relative;
    padding-bottom: 6px; /* room for underline */
}

.library-title {
    font-size: 3em;
    font-weight: 700;
    margin-bottom: 10px;
}

.library-subtitle {
    font-size: 16px;
    margin: 0;
    opacity: 0.9;
}

/* ===============================
   UNDERLINE EFFECT (Desktop Only)
   =============================== */
@media (min-width: 992px) {
    .library-header-inner::after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 0;
        width: 0%;
        height: 3px;
        background-color: #D4AF37;
        transition: width 0.35s ease-in-out;
        border-radius: 2px;
    }

    /* Hover anywhere → underline shows under text ONLY */
    .library-header-block:hover .library-header-inner::after {
        width: 100%;
    }
}

/* ===============================
   RESPONSIVE TEXT SIZES
   =============================== */
@media (max-width: 1200px) {
    .library-title {
        font-size: 2.6em;
    }
}

@media (max-width: 992px) {
    .library-title {
        font-size: 2.3em;
    }
}

@media (max-width: 768px) {
    .library-title {
        font-size: 2em;
    }
    .library-subtitle {
        font-size: 15px;
    }
}

@media (max-width: 576px) {
    .library-title {
        font-size: 1.7em;
    }
    .library-subtitle {
        font-size: 14px;
    }
}

/* search bar css */

.book-search-wrapper {
    width: 100%;
    max-width: 600px; /* optional: max width on large screens */
    margin-left: auto;
    margin-right: auto; /* center */
}

.book-search-wrapper .input-group {
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 50px;
    overflow: hidden;
    background-color: #fff; /* Light mode background */
}

.book-search-wrapper .form-control {
    border: none;
    border-radius: 0;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background-color: transparent; /* inherit from input-group */
    color: #333; /* text color */
}

.book-search-wrapper .form-control::placeholder {
    color: #888;
}

.book-search-wrapper .form-control:focus {
    box-shadow: none;
    outline: none;
}

.book-search-wrapper .input-group-text {
    border: none;
    background: transparent;
    font-size: 1.2rem;
    color: #333399; /* Light mode icon color */
}

:root[data-bs-theme="dark"] .book-search-wrapper .input-group-text {
    background-color: transparent !important; /* Important to override Bootstrap default */
    color: #ffffff; /* Icon white in dark mode */
}

:root[data-bs-theme="dark"] .book-search-wrapper .form-control {
    color: #fff; /* text white */
    background-color: transparent; /* keep input transparent */
}

:root[data-bs-theme="dark"] .book-search-wrapper .form-control::placeholder {
    color: #ccc; /* placeholder soft white */
}

:root[data-bs-theme="dark"] .book-search-wrapper .input-group {
    background-color: #313A46; /* Dark mode background */
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .book-search-wrapper .form-control {
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .book-search-wrapper {
        max-width: 90%;
    }
    .book-search-wrapper .form-control {
        font-size: 0.9rem;
    }
}


/* Container must be relative for absolute children */

.most-reviewed-section .slider-wrapper-mostreview {
    position: relative;
    overflow: hidden;
}

/* Slider itself */
.most-reviewed-slider {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 0; /* optional spacing */
    -ms-overflow-style: none;  /* IE & Edge */
    scrollbar-width: none; 
}

/* Cards inside the slider */
.most-reviewed-card {
    flex: 0 0 auto;
    width: 200px; /* adjust as needed */
}

.most-reviewed-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.25);
}

/* Arrows */
.most-reviewed-left-arrow,
.most-reviewed-right-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);  /* slightly transparent dark background */
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;            /* circular */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;          /* smooth hover */
    padding: 0;                    /* padding handled by width/height */
}

/* Left & right positions */
.most-reviewed-left-arrow { left: 5px; }
.most-reviewed-right-arrow { right: 5px; }

/* Optional hover effect */
.most-reviewed-left-arrow:hover,
.most-reviewed-right-arrow:hover {
    background: rgba(0,0,0,0.9);
    transform: translateY(-50%) scale(1.1);
}


.most-reviewed-slider::-webkit-scrollbar {
    display: none;             /* Chrome, Safari, Opera */
}

.most-reviewed-card {
    flex: 0 0 calc((100% - 45px) / 4);  /* 4 cards per row, 15px gap between cards */
    max-width: calc((100% - 45px) / 4);
}

/* Mobile: Show 1 card */
@media (max-width: 576px) {
    .most-reviewed-card {
        flex: 0 0 calc(100% - 20px);
        max-width: calc(100% - 20px);
    }
}

/* Tablets: Show 2 cards */
@media (min-width: 577px) and (max-width: 768px) {
    .most-reviewed-card {
        flex: 0 0 calc((100% - 15px) / 2);
        max-width: calc((100% - 15px) / 2);
    }
}

/* Medium screens: Show 3 cards */
@media (min-width: 769px) and (max-width: 992px) {
    .most-reviewed-card {
        flex: 0 0 calc((100% - 30px) / 3);
        max-width: calc((100% - 30px) / 3);
    }
}


/* Slider wrapper */
.slider-wrapper-unique {
    position: relative;
    overflow: hidden; /* hides horizontal scroll */
    padding: 10px 0;
}

/* Slider */

/* Wrapper */
.new-arrivals-section-unique .slider-wrapper-unique {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Slider track */
.new-arrivals-slider-unique {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 5px 0;
}

.new-arrivals-slider-unique::-webkit-scrollbar {
    display: none;
}

/* Mobile: 1 card */
.book-card-unique {
    flex: 0 0 calc(100% - 10px);
    max-width: calc(100% - 10px);
    scroll-snap-align: start;
    margin: 0 5px;
}

.book-card-unique:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.25);
}

/* Tablet: 2 cards (≥768px) */
@media (min-width: 768px) {
    .book-card-unique {
        flex: 0 0 calc(50% - 12px);
        max-width: calc(50% - 12px);
    }
}

/* Desktop: 3 cards (≥992px) */
@media (min-width: 992px) {
    .book-card-unique {
        flex: 0 0 calc(33.333% - 10px);
        max-width: calc(33.333% - 10px);
    }
}

/* Large desktop: 4 cards (≥1200px) */
@media (min-width: 1200px) {
    .book-card-unique {
        flex: 0 0 calc(25% - 12px);
        max-width: calc(25% - 12px);
    }
}

/* Image container */
.book-img-container {
    height: 300px;
    overflow: hidden;
}

@media (max-width: 767px) {
    .book-img-container {
        height: 180px;
    }
}

/* Arrows */
.slider-arrow-left-unique,
.slider-arrow-right-unique {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.slider-arrow-left-unique:hover,
.slider-arrow-right-unique:hover {
    background: rgba(0,0,0,0.9);
}

/* Position */
.slider-arrow-left-unique { left: 10px; }
.slider-arrow-right-unique { right: 10px; }

/* Mobile arrow sizing */
@media (max-width: 767px) {
    .slider-arrow-left-unique,
    .slider-arrow-right-unique {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}
