.book-card {
    flex: 0 0 auto;
    width: 100%;
    max-width: 300px; /* Control maximum width */
    margin: 0 10px;
    display: flex;
    flex-direction: column;
}

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

.carousel-view-all-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}


.card {
    color: inherit;
    cursor: pointer;
    width: 100%;
    aspect-ratio: 3 / 4; /* 3:4 aspect ratio based on standard cover size */
    position: relative;
    display: flex;
    flex-direction: column;
    --bs-card-border-color: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 -1px 2px rgba(0, 0, 0, 0.1),
    0px 1px 5px rgba(0, 0, 0, 0.1),-1px 0 2px rgba(0, 0, 0, 0.1);
}

#view-all-box {
    box-shadow: none;
}

.front, .back {
    display: flex;
    border-radius: 0px;
    background-position: center;
    background-size: cover;
    text-align: center;
    justify-content: center;
    align-items: center;
    position: absolute;
    height: 100%;
    width: 100%;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.front {
    overflow: hidden;
    font-family: Poppins, sans-serif;
}

.front:before {
    position: absolute;
    display: block;
    content: '';
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a9be6, #1a57e6);
    opacity: 0;
    z-index: -1;
}

.card.flipped .front {
    transform: rotateY(180deg);
}

.card.flipped .back {
    transform: rotateY(0deg);
}

.back {
    background-color: rgba(255, 250, 183, 0.5);
    transform: rotateY(-180deg);
    padding: 0 1em;
}

.back .book-details h3 {
      font-size: 1.3rem;
}

.card-img {
    width: 100%;
    height: auto; /* Removes fixed height and adapts to the aspect ratio */
    object-fit: contain; /* Ensures the image doesn't get stretched */
}

.back {
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
    align-items: center;
}

.back .type {
    display: flex;
    flex-direction: column;
}

.book-details h3 {
    text-align: center;
    font-size: 1.2rem;
    margin: 10px 0;
}

@media (min-width: 992px) and (max-width: 1090px) {
    .back button.details-button {
        font-size: small;
    }
    .back p {
        margin-bottom: 0;
    }
    .back .book-details h3 {
        font-size: 1rem;
        margin: 5px;
    }
}

@media (max-width: 991px) {
    .books-section .book-card {
        width: calc(98% - 10px); /* Adjust to fit two cards on small screens */
    }

    .books-section h2 {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .back .book-details h3 {
      font-size: 1rem;
    }

    .back .book-details p {
      font-size: 0.8rem;
    }

}

@media (max-width: 769px) {
    .back .book-details h3 {
      font-size: 1rem;
    }

    .back .book-details p {
      font-size: 0.8rem;
    }
}

@media (min-width: 560px) and (max-width: 701px) {
    .back button.details-button {
        font-size: small;
    }
    .back p {
        margin-bottom: 0;
    }
    .back .book-details h3 {
        font-size: 0.8rem;
        margin: 5px;
    }
}

@media (max-width: 478px) {
    .back button.details-button {
        font-size: small;
    }
    .back p {
        margin-bottom: 0;
    }
    .back .book-details h3 {
        font-size: 0.8rem;
        margin: 5px;
    }
}

@media (max-width: 360px) {
    .back button.details-button {
        font-size: smaller;
    }
    .back p {
        font-size: 0.4rem;
        margin-bottom: 0;
    }
    .back .star-rating {
        font-size: 0.7rem;
    }
    .back .book-details h3 {
        overflow: hidden;
        max-height: 16px;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-clamp: 1; /* For non-WebKit browsers */
        font-size: 0.8rem;
        margin: 5px;
    }
}

@media (max-width: 340px) {
    .back p {
        display: none;
    }
}

@media (max-width: 237px) {
    .back button.details-button {
        font-size: x-small;
    }
}



@media (min-width: 992px) and (max-width: 1300px) {
    .books-section .book-card {
        width: calc(98% - 10px); /* Adjust to fit two cards on small screens */
    }
}