body {
  min-height: 100svh;
}

main {
  display: grid;
  grid-template-rows: auto auto;
  gap: 2rem;
  padding: 2rem !important;
}

.book-info {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 4fr;
  gap: 2rem;
}

.book-info > img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  object-position: center;
  border-radius: 1rem;
}

.book-info > div {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.book-info > div > div {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.book-info .title {
  font-size: 2rem;
  font-weight: 700;
}

.book-info .author {
  font-size: 1.75rem;
  font-weight: 400;
}

.book-info .desc {
  font-size: 1.25rem;
  font-weight: 400;
  opacity: 0.75;
}

.book-info .price {
  font-size: 1.5rem;
  font-weight: 600;
}

.book-info .price.promo-active {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.book-info .price .original-price {
  font-size: 1.25rem;
  font-weight: 400;
}

.book-info .price .promo-price {
  font-size: 1.5rem;
}

.promo-badge-inline {
  display: inline-block;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 0.35rem;
}

.book-info .book-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.book-info .book-details > h4 {
  font-size: 1rem;
  font-weight: 400;
}

.book-info .book-details > h4 > span {
  font-weight: 500;
}

.book-info .rating-text {
  font-size: 1rem;
  font-weight: 500;
}

.book-info .quantity {
  display: flex;
  gap: 1rem;
  align-items: center;
  background-color: var(--secondary-color);
  padding: 0.9rem;
  border-radius: 1rem;
}

.book-info .quantity p {
  width: 1rem;
  text-align: center;
}

.book-info .quantity button {
  background-color: var(--primary-color);
  color: var(--text-color);
  font-size: 1.5rem;
  font-weight: 500;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;

  display: flex;
  justify-content: center;
  align-items: center;

  transition: background-color 0.3s ease;
}

.book-info .quantity button:disabled {
  background-color: var(--background-color);
  color: var(--text-color);
}

.book-info .quantity button:disabled:hover {
  background-color: var(--background-color);
}

.book-info .buttons > button:first-of-type {
  background-color: var(--secondary-color);
}

.book-info .buttons > button:first-of-type:hover {
  background-color: var(--primary-color);
}

.book-info .quantity button:hover {
  background-color: var(--background-color);
}

.book-info .stars {
  margin-left: 1rem;
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
}

.book-info .stars img {
  width: 1.5rem;
  height: 1.5rem;
  filter: invert(1);
}

.stars {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.stars-outer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.stars-inner {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  color: gold;
}

.stars-inner img,
.stars-outer img {
  width: 1.5rem; /* Adjust the size as needed */
  height: 1.5rem; /* Adjust the size as needed */
}

.stars-outer {
  opacity: 0.4;
}

.related-books {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.related-books h2 {
  font-size: 2rem;
  font-weight: 500;
}

.related-books > div {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.related-books > div > a {
  padding: 1rem;
  background-color: var(--primary-color);
  border-radius: 1rem;

  display: flex;
  flex-direction: column;
}

.related-books > div > a img {
  object-fit: cover;
  height: 180px;
  width: auto;
  max-width: 100%;
  object-position: center;
  border-radius: 1rem;
  margin: 0 auto;
  padding-bottom: 0.5rem;
}

.related-books > div > a h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

.related-books > div > a p {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.75;
}

.reviews {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
}

.reviews.active {
  display: flex;
  overflow: hidden;
  position: fixed;
}

.reviews-container {
  position: relative;
  width: 50%;
  height: 80%;
  background-color: var(--primary-color);
  padding: 1rem;
  border-radius: 1rem;

  display: grid;
  grid-template-rows: auto 1fr auto 2fr;
  gap: 1rem;
}

.reviews-container > h2 {
  font-size: 2rem;
  font-weight: 500;
}

.review-form {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 1rem;
}

.review-form > .review-rating {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  justify-content: end;
}

.review-form > .review-input {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.review-form > .review-input > textarea {
  height: 100%;
  padding: 0.5rem;
  background-color: var(--secondary-color);
  color: var(--text-color);
  border-radius: 1rem;
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.75;
  border: none;
  resize: none;
}

.review-form > .review-input > label {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.75;
}

.review-form > .review-rating > button {
  background-color: var(--secondary-color);
}

.review-form > .review-rating > button:hover {
  background-color: var(--background-color);
}

.review-form > .review-rating > button:disabled {
  background-color: var(--background-color);
}

.review-form > .review-rating > button:disabled:hover {
  background-color: var(--background-color);
}

.review-form > .review-rating img {
  width: 1.5rem;
  height: 1.5rem;
  filter: invert(1);
}

.reviews-list {
  height: 100%;
  display: grid;
  gap: 1rem;
  overflow-y: auto;
}

.reviews-list > p {
  font-size: 2rem;
  font-weight: 700;
  margin: auto 0;
  text-align: center;
}

.user-review {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--text-color);
}

.last-review {
  border-bottom: none;
  padding-bottom: 0;
}

.user-review img {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

.user-review > div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-review > div > div {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.user-review .username {
  font-size: 1.25rem;
  font-weight: 600;
}

.user-review .review-text {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.75;
}

.user-review > div > div .stars {
  height: 1.5rem;
  margin-top: -0.25rem;
  cursor: default;
}

.user-review > div > div img {
  width: 1.5rem;
  height: 1.5rem;
  filter: invert(1);
}

.review-close {
  position: absolute;
  top: 1rem;
  right: 1rem;

  width: 3rem;
  height: 3rem;
  padding: 0.5rem;
  border-radius: 50%;
  background-color: var(--secondary-color);

  display: flex;
  justify-content: center;
  align-items: center;

  transition: background-color 0.3s ease;
}

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

.review-close:hover img {
  transform: rotate(180deg);
}

.review-close img {
  width: 1.75rem;
  height: 1.75rem;
  filter: invert(1);

  transition: transform 0.3s ease;
}

/* Responsive adjustments */
@media (min-width: 2560px) {
  main {
    gap: 3rem;
    padding: 3rem !important;
  }

  .book-info {
    grid-template-columns: 1fr 3fr;
    gap: 3rem;
  }

  .book-info .title {
    font-size: 2.5rem;
  }

  .book-info .author {
    font-size: 2rem;
  }

  .book-info .desc {
    font-size: 1.5rem;
  }

  .book-info .price {
    font-size: 1.75rem;
  }

  .related-books h2 {
    font-size: 2.5rem;
  }

  .related-books > div > a h3 {
    font-size: 1.75rem;
  }

  .reviews-container {
    width: 45%;
  }

  .reviews-container > h2 {
    font-size: 2.5rem;
  }
}

@media (min-width: 1920px) {
  main {
    gap: 2.5rem;
    padding: 2.5rem !important;
  }

  .book-info {
    grid-template-columns: 1fr 3.5fr;
    gap: 2.5rem;
  }

  .book-info .title {
    font-size: 2.25rem;
  }

  .book-info .author {
    font-size: 1.85rem;
  }

  .reviews-container {
    width: 50%;
  }
}

@media (max-width: 1400px) {
  .book-info {
    grid-template-columns: 1fr 3fr;
  }

  .reviews-container {
    width: 60%;
  }
}

@media (max-width: 1200px) {
  main {
    grid-template-rows: auto auto;
  }

  .book-info {
    grid-template-columns: 1fr 2fr;
  }

  .reviews-container {
    width: 70%;
  }
}

@media (max-width: 992px) {
  main {
    grid-template-rows: auto auto;
    padding: 1.5rem !important;
  }

  .book-info {
    grid-template-columns: 1fr;
  }

  .book-info > img {
    max-height: 400px;
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
  }

  .book-info .buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .book-info .buttons > .quantity {
    flex: 0 0 auto;
  }

  .book-info .buttons > button {
    flex: 1 1 auto;
    min-width: fit-content;
  }

  .book-info .title {
    font-size: 1.75rem;
  }

  .book-info .author {
    font-size: 1.5rem;
  }

  .related-books > div {
    grid-template-columns: 1fr 1fr;
  }

  .reviews-container {
    width: 90%;
    height: 80%;
    grid-template-rows: auto 1fr auto auto;
  }

  .review-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  main {
    padding: 1.25rem !important;
    gap: 1.5rem;
  }

  .book-info {
    gap: 1.25rem;
  }

  .book-info > img {
    max-height: 320px;
    max-width: 280px;
  }

  .book-info .title {
    font-size: 1.5rem;
  }

  .book-info .author {
    font-size: 1.25rem;
  }

  .book-info .desc {
    font-size: 1rem;
  }

  .book-info .price {
    font-size: 1.25rem;
  }

  .book-info > div > div {
    flex-wrap: wrap;
  }

  .book-info .quantity {
    width: auto;
    justify-content: center;
  }

  .book-info .buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }

  .book-info .buttons > .quantity {
    flex: 0 0 auto;
  }

  .book-info .buttons > button {
    flex: 1 1 auto;
    min-width: fit-content;
  }

  .related-books {
    gap: 1rem;
  }

  .related-books h2 {
    font-size: 1.5rem;
  }

  .related-books > div {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .related-books > div > a {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
  }

  .related-books > div > a img {
    width: 80px;
    height: 100px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    object-fit: cover;
    border-radius: 0.5rem;
  }

  .related-books > div > a > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .related-books > div > a h3 {
    font-size: 1.1rem;
  }

  .reviews-container {
    width: 95%;
    height: 85%;
    padding: 1rem;
  }

  .reviews-container > h2 {
    font-size: 1.5rem;
  }

  .review-close {
    width: 2.5rem;
    height: 2.5rem;
    top: 0.75rem;
    right: 0.75rem;
  }
}

@media (max-width: 576px) {
  main {
    padding: 1rem !important;
    gap: 1.25rem;
  }

  .book-info > img {
    max-height: 280px;
    max-width: 220px;
  }

  .book-info .title {
    font-size: 1.35rem;
  }

  .book-info .author {
    font-size: 1.15rem;
  }

  .book-info .desc {
    font-size: 0.95rem;
  }

  .book-info .quantity {
    width: auto;
    justify-content: center;
  }

  .book-info .buttons {
    flex-direction: column;
  }

  .book-info .buttons > * {
    width: 100%;
  }

  .related-books > div {
    grid-template-columns: 1fr;
  }

  .related-books > div > a img {
    width: 60px;
    height: 80px;
  }

  .related-books > div > a h3 {
    font-size: 1rem;
  }

  .reviews-container {
    width: 98%;
    height: 92%;
    padding: 0.75rem;
  }

  .reviews-list > p {
    font-size: 1.25rem;
  }

  .user-review {
    gap: 0.75rem;
  }

  .user-review img {
    width: 2.5rem;
    height: 2.5rem;
  }

  .user-review .username {
    font-size: 1rem;
  }

  .user-review .review-text {
    font-size: 0.9rem;
  }
}
