/* styles.css */
html {
  scroll-behavior: smooth;
}

/* loader_div */
#loader {
  border: 12px solid #f3f3f3;
  border-radius: 50%;
  border-top: 12px solid #444444;
  width: 70px;
  height: 70px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% {
      transform: rotate(360deg);
  }
}

.center {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
}
/* end of loader div */

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 2% 5%;
  background-image: url("bg.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  height: 100%;
  background-attachment: fixed;
  background-color: #9DC08B;
}

.parent {
  display: flex;
  justify-content: center;
  margin-top: 3%;
  animation: floating 1s 1;
}

.toggle-wrapper {
  background-color: #9DC08B;
  border-radius: 20px;
  width: 40%;
  padding: 0.3%;
}

.segmented-control {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  z-index: 1;
  color: #263A29;
  background-color: #9DC08B;
  backdrop-filter: blur(3.5px);
  -webkit-backdrop-filter: blur(3.5px);
  margin: 0 auto;
  padding: 2px;
  border-radius: 20px;
}

.segmented-control>input {
  display: none;
}

.segmented-control>input:checked+label {
  color: #fff !important;
}

.segmented-control>input:nth-of-type(1):checked~label:last-of-type:before {
  transform: translateX(calc(0% + 0px));
}

.segmented-control>input:nth-of-type(2):checked~label:last-of-type:before {
  transform: translateX(calc(100% + 0px));
}

.segmented-control label {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: lighter;
  padding: 1.7%;
  transition: color 250ms cubic-bezier(0, 0.95, 0.38, 0.98);
  margin-bottom: 0;
}

.segmented-control label:last-of-type:before {
  content: "";
  display: block;
  max-width: calc(50% - 0px);
  margin: 0px;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  transform: translateX(0);
}

.segmented-control label:before {
  border-radius: 20px;
  background: #41644A;
  transition: all 250ms cubic-bezier(0, 0.95, 0.38, 0.98);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

h1 {
  color: #41644A;
  text-align: center;
  margin-bottom: 20px;
  transition: transform 0.3s ease-in-out;
  animation: slide-up 0.5s ease-in-out;
  font-family: 'Righteous', cursive;
  font-size: 4rem;
}

h2 {
  color: #263A29;
  text-align: center;
  margin-bottom: 20px;
  transition: transform 0.3s ease-in-out;
  animation: slide-up 0.5s ease-in-out;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem;
}

h3 {
  color: #E3F2C1;
  font-size: 1.5rem;
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
}

/* .content {
  display: flex;
  flex-direction: column;
  align-items: center;
} */
form {
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  background: rgba(221, 255, 187, 0.25);
  backdrop-filter: blur(3.5px);
  -webkit-backdrop-filter: blur(3.5px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  width: 40%;
  margin: 3% auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.slide-left {
  position: relative;
  animation: animateright 0.4s
}

@keyframes animateright {
  from {
    right: -300px;
    opacity: 0
  }

  to {
    right: 0;
    opacity: 1
  }
}

.slide-right {
  position: relative;
  animation: animateleft 0.4s
}

@keyframes animateleft {
  from {
    left: -300px;
    opacity: 0
  }

  to {
    left: 0;
    opacity: 1
  }
}

.field {
  margin-bottom: 10px;
}

.field label {
  font-weight: bold;
}

.title {
  display: block;
  opacity: 1;
}

.genre {
  display: none;
  opacity: 0;
}

.show {
  opacity: 1;
}

/* end of segmented control */
.form-heading {
  font-weight: bolder;
  font-size: 2rem;
  color: #263A29;
}

input[type="text"],
button {
  font-size: 16px;
  padding: 10px;
  border: none;
  border-radius: 12px;
  transition: background-color 0.3s ease-in-out;
}

input[type="text"] {
  background-color: #9DC08B;
  color: #41644A;
  margin: 2% auto;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  width: 60%;
  animation: floating 1s 1;
}

#authorInput{
  animation: floating 1.3s 1;
}

input[type="text"]:focus {
  outline: none;
  background-color: #A4BC92;
}

.mainBtn {
  background-color: #41644A;
  color: #fff;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  box-shadow: 1px 4px 8px rgba(0, 0, 0, 0.3);
  margin-top: 3%;
  padding: 3%;
  font-size: 1.3rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mainBtn:hover {
  background-color: #A4BC92;
  color: #263A29
}

.text-ani{
  transition: transform 0.3s ease-in-out;
  animation: slide-up 0.5s ease-in-out;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.button-loader {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 4px solid #A4BC92;
  border-top-color: #263A29;
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}

@keyframes floating {
  0% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(0, -10px);
  }

  100% {
    transform: translate(0, 0);
  }
}

/* .down-arrow {
  color: #A4BC92;
  position: relative;
  bottom: 30px;
  animation: floating 1s infinite!important;
} */

/* .down-arrow:hover {
  color: #9DC08B;
} */

/* .invisibile {
  visibility: hidden;
} */

#recommendations {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 20px;
  animation: fade-in 0.5s ease-in-out;
  position: relative;
  width: 100%;
  height: 100%;
  margin: 20px auto auto;
  text-align: center;
}

.book {
  background-color: #A4BC92;
  border-radius: 20px;
  padding: 3%;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  /* text-shadow: 1px 1px 1px #000; */
  transition: transform 0.3s ease-in-out;
  animation: slide-up 0.5s ease-in-out;
  text-align: center;
  margin: 5% auto;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  min-height: 350px;
  max-width: 210px;
  position: relative;
  z-index: +1;
  animation: floating 1s 1;
}


.background-overlay {
  border-radius: 20px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* backdrop-filter: blur(4px);
  background-color: rgba(164, 188, 146, 0.2); */
  backdrop-filter: blur(4px);
  background-color: rgba(65, 100, 74, 0.6);
  pointer-events: none;
  z-index: -1;
}

.book:hover {
  transform: scale(1.05);
}

.book-title{
  color: #EDF1D6;
  text-shadow: 0.5px 0.5px 0.5px #c6c6c6;
  font-size: 2rem;
  font-weight: bolder;
}

.sub-title{
  font-weight: 600;
}

.book-description {
  max-height: 3em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Limit to 3 lines */
  -webkit-box-orient: vertical;
}

.read-more {
  display: inline-block;
  background-color: #41644A;
  cursor: pointer;
  margin-top: 0;
  padding: 5%;
  font-size: 1.2rem;
  border-radius: 10px;
  animation: floating 1s 1;
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  margin: 0 auto;
  text-align: center;
  width: fit-content;
}

.read-more:hover{
  background-color: #A4BC92;
  color: #41644A;
}

.close-button{
  background: none;
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  font-size: 2.5rem;
  color: #41644A;
  cursor: pointer;
  z-index: 11;
  padding-top: 0;
  padding-bottom: 0;
}

.close-button:hover{
  color: #fff;
}

.popUp-book{
  z-index: +10;
  position: relative;
  display: flex;
  border-radius: 20px;
}

.book-image {
  flex: 1;
  margin-right: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.book-image img {
  min-width: 50%;
  max-width: 100%;
  min-height: 300px;
  border-radius: 20px;
  position: relative;
	box-shadow: 5px 5px 50px 0 rgba(0,0,0,0.75);
}

.book-info {
  font-family: 'Space Grotesk', sans-serif;
  flex: 2;
  text-align: left;
  overflow-y: scroll;
  height: 50vh;
}

.book-info::-webkit-scrollbar {
  width: 2px;               /* width of the entire scrollbar */
}

.book-info::-webkit-scrollbar-track {
  background: #A4BC92 ;        /* color of the tracking area */
}

.book-info::-webkit-scrollbar-thumb {
  background-color: #41644A;    /* color of the scroll thumb */
  border-radius: 20px;       /* roundness of the scroll thumb */
  border: none;  /* creates padding around scroll thumb */
}

.popUp-title{
  color: #41644A;
  font-size: 2.5rem;
  font-weight: bold;
}

body.active-modal {
  overflow: scroll;
}
body.active-modal header.header {
  transition: 0.2s;
  filter: blur(2px);
}

.box-modal {
  position: fixed;
  width: 100%;
  height: 100vh;
  left: 0px;
  top: 0px;
  visibility: hidden;
  z-index: +5;
  transition: transform 0.3s ease-in-out;
  animation: slide-up 0.5s ease-in-out;
}
.box-modal .overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0px;
  top: 0px;
  background: #000;
  opacity: 0;
  transition: opacity 2s;
}
.box-modal .body-modal {
  max-height: 0px;
  opacity: 0;
  overflow: scroll;
}

.box-modal .body-modal::-webkit-scrollbar {
  width: 5px;               /* width of the entire scrollbar */
}

.box-modal .body-modal::-webkit-scrollbar-track {
  background: none;        /* color of the tracking area */
}

.box-modal .body-modal::-webkit-scrollbar-thumb {
  background: none;      /* roundness of the scroll thumb */
  border: none;  /* creates padding around scroll thumb */
}

.box-modal .body-modal .inner-body-modal {
  background: #A4BC92;
  padding: 25px;
  border-radius: 20px;
  position: relative;
  z-index: 1;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
  transition: transform 0.3s ease-in-out;
  animation: slide-up 0.5s ease-in-out;
}

.body-modal{
  border-radius: 20px;
}

.box-modal.modal-show {
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: visible;
  transition: all 2s;
}
.box-modal.modal-show .overlay {
  opacity: 0.5;
  transition: opacity 0.5s;
}
.box-modal.modal-show .body-modal {
  max-height: 1000px;
  opacity: 1;
  transition: 0.1s max-height 0.1s, 0.1s opacity 0.1s;
}

#errorSection{
  display: flex;
  justify-content: center;
  margin-bottom: 3%;
}

.error-message{
  font-family: 'Space Grotesk', sans-serif;
  color: red;
  font-size: 1.6rem;
  margin-bottom: 0;
}


#showMoreButton {
  background-color: #41644A;
  color: #fff;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  margin: 2% auto;
  padding: 1%;
  font-size: 1.3rem;
}

.showMoreBtn:hover {
  background-color: #A4BC92 !important;
}

.footerText {
  margin-top: 0;
  font-size: 1.7rem;
}

@media (max-width: 992px) {
  body {
    overflow-x: none;
  }

  h3{
    color: #444444;
  }

  #titleInput, #authorInput, #genreInput{
    width: 90%;
  }

  .parent{
    margin-top: 15%;
  }

  .segmented-control {
    margin: 2px;
    padding: 0;
    width: 100%;
  }

  .toggle-wrapper{
    width: 100%;
    margin-top: 0;
  }

  form {
    width: 100%;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }

  #recommendations{
    grid-template-columns: repeat(1, 1fr);
  }

  #showMoreButton{
    padding: 3%;
    margin-bottom: 5%;
  }

  .popUp-book {
    flex-direction: column;
  }

  .popUp-book{
    height: 70vh;
  }

  .book-image {
    margin-bottom: 5px;
  }

  .footerText{
    color: #A4BC92;
  }
}

/* scroll bar */
body::-webkit-scrollbar {
  width: 5px;               /* width of the entire scrollbar */
}

body::-webkit-scrollbar-track {
  background: #41644A;        /* color of the tracking area */
}

body::-webkit-scrollbar-thumb {
  background-color: #A4BC92;    /* color of the scroll thumb */
  border-radius: 20px;       /* roundness of the scroll thumb */
  border: none;  /* creates padding around scroll thumb */
}

/* Animation Keyframes */
@keyframes scale-in {
  0% {
    transform: scale(0);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes slide-up {
  0% {
    transform: translateY(20px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fade-in {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes animateLeft {
  from {
    margin-left: -200px;
    opacity: 0;
  }

  to {
    margin-left: 0;
    opacity: 1;
  }
}
