@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;700&display=swap');

.books-section {
    padding: 3rem 1rem;
    background-color: #f4f8fc;
    font-family: 'Lexend', sans-serif;
}

    .books-section h1 {
        text-align: center;
        font-size: 2.6rem;
        margin-bottom: 1rem;
        color: #003344;
    }

    .books-section .intro {
        text-align: center;
        max-width: 700px;
        margin: 0 auto 2rem;
        font-size: 1.2rem;
        color: #555;
    }

.search-bar {
    display: block;
    width: 90%;
    max-width: 400px;
    margin: 2rem auto 1rem;
    padding: 0.9rem 1.2rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 30px;
    outline: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

/* === CATEGORY FILTERS === */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.category-btn {
    background-color: #000000;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

    .category-btn:hover {
        background-color: #005566;
    }

    .category-btn.clear-category {
        
        background-color: #b8950b;
    }

        .category-btn.clear-category:hover {
            color: #000000;
            background-color: #B8860b;
        }

/* === BOOK GRID === */
.book-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2rem;
    justify-items: center;
}

@media (min-width: 600px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .book-grid {
        grid-template-columns: repeat(3, 1fr);
    }

        /* Center if only one card visible */
        .book-grid:has(.book-card:only-child) {
            justify-content: center;
        }
}

/* === BOOK CARD === */
.book-card {
    max-width: 400px;
    border-radius: 16px;
    transition: transform 0.2s ease;
    cursor: pointer;
    text-align: center;
    position: relative;
    z-index: 1;
}

    .book-card:hover {
        transform: translateY(-6px);
    }

.book-img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    border-radius: 15px;
}

/* === BOOK ACTIONS === */
.book-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin: 1rem 0 1.5rem;
    position: relative;
    z-index: 2;
}

    .book-actions a,
    .buy-button {
        text-decoration: none;
        padding: 0.6rem 1.2rem;
        font-weight: 600;
        border-radius: 8px;
        font-size: 0.95rem;
        transition: background 0.2s ease;
        border: none;
        cursor: pointer;
        white-space: nowrap;
    }

.buy-button {
    background-color: #000000;
    color: white;
}

    .buy-button:hover {
        background-color:  #005566;
    }

.audio-button,
.video-button {
    background-color: #00bfff;
    color: white;
}

    .audio-button:hover,
    .video-button:hover {
        background-color: #0099cc;
    }

/* === DROPDOWN === */
.buy-dropdown {
    position: relative;
    z-index: 1000;
}

.buy-options {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 2000;
    padding: 0.5rem 0;
    list-style: none;
    display: block;
    margin-bottom: 0.5rem;
}

    .buy-options.hidden {
        display: none;
    }

    .buy-options li a {
        display: block;
        padding: 0.75rem 1.2rem;
        color: #003344;
        text-decoration: none;
        font-weight: 500;
        transition: background 0.3s ease;
    }

        .buy-options li a:hover {
            background-color: #f4f8fc;
        }

/* === SHOW MORE / LESS === */
.button-group {
    text-align: center;
    margin-top: 2rem;
}

    .button-group button {
        background-color:#b8950b;
        color: white;
        border: none;
        border-radius: 8px;
        padding: 0.9rem 2rem;
        font-size: 1rem;
        cursor: pointer;
        transition: background-color 0.3s ease;
        margin: 0 0.5rem;
    }

        .button-group button:hover {
            color: #000000;
            background-color: #B8860b;
        }

/* === MODAL === */
.book-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 1rem;
    box-sizing: border-box;
}

    .book-popup.hidden {
        display: none;
    }

.book-popup-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

    .book-popup-content h3 {
        font-size: 1.5rem;
        color: #00bfff;
        margin-bottom: 1rem;
    }

    .book-popup-content p {
        font-size: 1rem;
        color: #333;
        line-height: 1.6;
    }

.book-popup-close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 24px;
    color: #00b300;
    background: none;
    border: none;
    cursor: pointer;
}

    .book-popup-close:hover {
        color: #00bfff;
    }

/* === MOBILE FIXES === */
@media (max-width: 600px) {
    .books-section {
        padding: 2rem 1rem;
    }

        .books-section h1 {
            font-size: 2rem;
        }

        .books-section .intro {
            font-size: 1rem;
            padding: 0 1rem;
        }

    .search-bar {
        width: 90%;
        margin: 1.5rem auto;
        font-size: 1rem;
        padding: 0.8rem 1rem;
    }

    .book-img {
        aspect-ratio: 2 / 3;
        height: auto;
    }

    .book-card {
        margin-bottom: 2rem;
    }

    .book-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    .buy-button,
    .audio-button,
    .video-button {
        font-size: 0.9rem;
        padding: 0.55rem 1rem;
    }

    .buy-options {
        top: auto;
        bottom: 100%;
        margin-bottom: 0.5rem;
        left: 50%;
        transform: translateX(-50%);
        min-width: 160px;
        border-radius: 12px;
        padding: 0.4rem 0;
    }

        .buy-options li a {
            padding: 10px 14px;
            font-size: 0.95rem;
            text-align: center;
        }

    .book-popup-content {
        padding: 1.2rem;
        max-width: 90vw;
    }

        .book-popup-content h3 {
            font-size: 1.3rem;
        }

        .book-popup-content p {
            font-size: 1rem;
        }

    .book-popup-close {
        font-size: 24px;
        top: 10px;
        right: 14px;
    }
}
