* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "PT Serif", serif;
}

body {
  background-color: #ffffff;
  color: #333;
  overflow-x: hidden;
  /* Disable horizontal scrolling */
}

header {
  background-color: #ffffff;
  border-bottom: 1px solid #ffffff;
  padding: 20px 50px;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar ul {
  list-style-type: none;
  display: flex;
  gap: 20px;
}

.navbar ul li a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
}

.search-signin {
  display: flex;
  align-items: center;
  gap: 15px;
  /* Space between elements */
}

/* Style for the search button to match the Explore Now button */
.search-button {
  padding: 10px 20px;
  background-color: #333;
  color: #f8efe4;
  text-decoration: none;
  display: inline-block;
  border: none;
}

.search-button:hover {
  background-color: #555;
  color: #fff;
}

.search-box {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #333;
  /* Bottom border for search input */
  padding-bottom: 5px;
  /* Space below the input */
}

.search-box input {
  border: none;
  outline: none;
  font-size: 14px;
  font-family: "PT Serif", serif;
  /* Consistent font */
  width: 200px;
  /* Adjust width of input field */
}

.search-box input::placeholder {
  color: #333;
  /* Placeholder color */
  background-color: transparent;
}

.search-signin span {
  color: #333;
}

.signin-link {
  text-decoration: none;
  font-size: 14px;
  font-family: "PT Serif", serif;
  color: #333;
  font-weight: bold;
}

.hero {
  background-color: #f8efe4;
  padding: 50px;
  overflow: hidden;
  /* Hide any overflow caused by child elements */
  margin: 0;
}

.hero-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 0;
}

.text-content {
  max-width: 40%;
}

.text-content h2 {
  font-size: 3em;
  font-family: "PT Serif", serif;
  /* Make sure it's PT Serif */
  font-weight: 700;
  /* Bold the h2 */
}

.text-content p {
  margin: 20px 0;
  font-size: 1.2em;
  font-family: "PT Serif", serif;
  font-weight: 400;
  /* Regular for paragraphs */
}

.text-content button {
  padding: 10px 20px;
  background-color: #333;
  color: #f8efe4;
  border: none;
}

.text-content button:hover {
  background-color: #555;
  /* Darker hover effect */
  color: #fff;
}

.book-slider {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.book-slider .book {
  text-align: center;
  position: relative;
}

.book-slider .book img {
  width: 180px;
  height: 300px;
  object-fit: cover;
  border: 1px solid #ddd;
  display: block;
  margin: 0 auto;
}

.book-slider .book p {
  margin-top: 10px;
  font-weight: bold;
  font-size: 16px;
  color: #333;
  font-family: "PT Serif", serif;
  /* Regular for book titles */
  font-weight: 400;
}

.book-slider .framed img {
  border-radius: 100px 100px 0 0;
}

/* Middle book (reverse-rounded, bottom-rounded) */
.book-slider .framed.reverse img {
  border-radius: 0 0 100px 100px;
}

.book-slider .book.reverse p {
  position: static;
  margin-bottom: 10px;
  font-weight: bold;
  font-size: 16px;
  color: #333;
  font-family: "PT Serif", serif;
}

.bestsellers {
  background-color: #f4f4f4;
  padding: 50px;
}

.bestsellers-header {
  display: flex;
  justify-content: center;
  /* Center the "Bestsellers" heading */
  position: relative;
  /* Allows for absolute positioning of buttons */
  align-items: center;
  margin-bottom: 20px;
}

.bestsellers h2 {
  margin: 0;
  font-size: 2em;
  font-family: "PT Serif", serif;
  font-weight: 700;
  text-align: center;
  /* Center the heading */
}

.sort-filter {
  position: absolute;
  /* Position the buttons to the right */
  right: 0;
  /* Align the buttons to the right side */
  display: flex;
  gap: 15px;
  /* Space between the buttons */
}

.sort-filter button {
  padding: 10px 20px;
  /* Same padding as "Explore Now" button */
  background-color: #333;
  color: #f8efe4;
  border: none;
}

.sort-filter button:hover {
  background-color: #555;
  /* Darker background on hover */
  color: #fff;
  /* White text on hover */
}

.book-list {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 30px;
  overflow-x: auto;
  /* Enable horizontal scrolling */
  white-space: nowrap;
  /* Prevent items from wrapping */
  padding-bottom: 10px;
  /* Space below items */
  flex-wrap: wrap;
  /* Allows items to wrap to the next line if necessary */
}

.book-item {
  flex: 1 1 calc(25% - 10px);
  /* 4 columns on larger screens with reduced gap */
  text-align: center;
  margin: 5px 0;
  /* Reduced margin */
}

.book-item img {
  width: 150px;
  height: 220px;
  object-fit: cover;
  border-radius: 10px;
}

.book-item button {
  padding: 5px 15px;
  background-color: #333;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 10px;
}

.book-item button:hover {
  background-color: #555;
  /* Darker background on hover */
}

.dropdown-button {
  position: relative;
  /* Ensures that dropdown menu is positioned relative to this button */
}

.dropdown-menu {
  display: none;
  /* Hidden by default */
  position: absolute;
  top: 100%;
  /* Align below the button */
  right: 0;
  /* Align with the right edge of the button */
  background-color: white;
  border: 1px solid #ccc;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
  width: 200px;
  /* Adjust width to match button */
}

.dropdown-menu select {
  width: 100%;
  padding: 10px;
  border: none;
}

#sort-dropdown {
  position: absolute;
  top: 100%;
  /* Ensures the dropdown appears right below the button */
  left: 0;
  /* Aligns the dropdown with the left side of the button */
  background-color: #fff;
  /* Sets a white background for the dropdown */

  border: 1px solid #ccc;
  /* Adds a light border for visibility */
  display: none;
  /* Hidden by default, shown when the button is clicked */
  width: 100px;
  /* Ensures the dropdown has a fixed width */
  padding: 10px;
  /* Adds padding inside the dropdown for spacing */
  appearance: none;
  /* Remove the default styling */
  -webkit-appearance: none;
  /* For Safari */
  -moz-appearance: none;
  /* For Firefox */
  cursor: pointer;
}

#sort-dropdown:focus {
  outline: none;
  color: #555;
  /* Custom focus border */
  background-color: #fff;
  /* Prevent background color change */
}

#sort-dropdown option:checked {
  background-color: #555;
  /* Background color for the selected option */
  color: #fff;
  /* Text color for the selected option */
}

/* Sort button */
.sort-btn,
.genre-btn {
  padding: 10px 20px;
  background-color: #333;
  color: #f8efe4;
  border: none;
  width: 100px;
  /* Same width for both the button and the dropdown */
  text-align: center;
  cursor: pointer;
}

.sort-btn:hover,
.genre-btn:hover {
  background-color: #555;
  /* Darker background on hover */
}

/* Custom arrow for the dropdown */
#sort-dropdown {
  appearance: none;

  background-repeat: no-repeat;
  background-position: right 10px top 50%;
  padding-right: 30px;
  /* Adjust to make space for the arrow */
}

/* Hover effect for options */
#sort-dropdown option:hover {
  background-color: #ddd;
  /* Add hover effect on options */
}

.dropdown-item {
  padding: 8px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background-color: #f0f0f0;
}

.book-item p.title {
  max-width: 150px;
  /* Set a maximum width for the title */
  height: 50px;
  /* Fixed height */
  overflow: hidden;
  /* Hide the overflowed text */
  text-overflow: ellipsis;
  /* Add ellipsis (...) if text is too long */
  white-space: nowrap;
  /* Ensure text remains in a single line */
  text-align: center;
  /* Center the text */
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bestsellers {
  background-color: #f4f4f4;
  padding: 20px;
  /* Adjust this value to reduce padding */
  margin: 0;
  /* Ensure there's no margin */
}

.bestsellers-header {
  margin: 0;
  /* Remove any margin around the header */
  padding: 0;
  /* Ensure there's no extra padding */
}

.sort-filter {
  margin-top: 0;
  /* Remove top margin for the button container */
}

/* Genre Button and Dropdown */
.genre-filter {
  position: relative;
}

.genre-btn {
  padding: 10px 20px;
  background-color: #333;
  color: #f8efe4;
  border: none;
  width: 100px;
  text-align: center;
  cursor: pointer;
}

.genre-btn:hover {
  background-color: #555;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: white;
  border: 1px solid #ccc;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.dropdown-content.show {
  display: block;
  /* Show dropdown when 'show' class is added */
}

.dropdown-content select {
  padding: 10px;
  border: none;
  cursor: pointer;
  width: 100px;
}

.dropdown-content select:focus {
  outline: none;
  color: #555;
  background-color: #fff;
}

.dropdown-content option:hover {
  background-color: #ddd;
}

.dropdown-content option:checked {
  background-color: #555;
  color: #fff;
}

/* ---------------------------------------------------------------------- */
/* Small devices (Mobile phones) -----------------------------------------*/
@media (max-width: 600px) {
  .hero-content {
    flex-direction: column;
    align-items: center;
  }

  .text-content {
    max-width: 100%;
    text-align: center;
  }

  .book-slider .book img {
    width: 120px;
    height: 180px;
  }

  .book-item img {
    width: 100px;
    height: 150px;
  }

  .hero-content {
    flex-direction: row;
  }

  .book-slider .book img {
    width: 150px;
    height: 220px;
  }

  .book-item img {
    width: 120px;
    height: 180px;
  }

  .book-item {
    flex: 1 1 calc(50% - 20px);
    /* 2 columns on small screens (600px and below) */
    margin: 0;
    /* Adjust margin to prevent overflow */
  }
}

/* Large devices (Desktops) */
@media (min-width: 1024px) {
  .hero-content {
    flex-direction: row;
  }

  .book-slider .book img {
    width: 180px;
    height: 300px;
  }

  .book-item img {
    width: 150px;
    height: 220px;
  }
}

.book-list {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
}

.book-item {
  flex: 1 1 calc(16.66% - 20px);
  /* 6 columns on larger screens */
  text-align: center;
  margin: 0;
}

/* Medium devices (Tablets, iPads) */
@media (max-width: 1024px) {
  .book-item {
    flex: 1 1 calc(25% - 20px);
    /* 4 columns on tablets */
  }
}

/* 1 column for screens smaller than or equal to 400px */
@media (max-width: 400px) {
  .divider {
    display: none;
    /* Hides the element */
  }

  .book-item {
    flex: 1 1 100%;
    /* 1 column on very small screens (400px and below) */
  }
}

/* ------------------------------------------------------------ */
@media (max-width: 740px) {
  .divider {
    display: none;
    /* Hides the element */
  }

  .navbar {
    flex-direction: column;
    align-items: flex-start;
    /* Align logo and menu items to the left */
    padding-left: 0;
    /* Remove excessive padding */
  }

  .navbar ul {
    flex-direction: column;
    /* Stack the navigation links vertically */
    gap: 10px;
    /* Reduce the gap */
    margin-top: 20px;
    /* Add space below the logo */
  }

  .logo {
    margin-bottom: 10px;
    /* Space between logo and wishlist/search */
  }

  /* Search and sign-in button alignment */
  .search-signin {
    flex-direction: column;
    align-items: flex-start;
    /* Align search bar and sign-in vertically */
    margin-top: 10px;
  }

  .search-box {
    width: 100%;
    /* Full width for the search input */
  }

  .search-box input {
    width: 80%;
    /* Adjust input field width for smaller screens */
  }

  .search-button {
    width: 100%;
    /* Full width for search button */
    margin-top: 10px;
  }

  .hero {
    padding: 20px;
    /* Reduce padding */
  }

  .hero-content {
    flex-direction: column;
    align-items: center;
  }

  .text-content {
    max-width: 100%;
    text-align: center;
  }

  .text-content h2 {
    font-size: 2em;
    /* Smaller font for heading */
  }

  .text-content p {
    font-size: 1em;
    /* Adjust paragraph font size */
  }

  .book-slider .book img {
    width: 120px;
    height: 180px;
  }

  .book-item img {
    width: 100px;
    height: 150px;
  }

  .sort-filter {
    display: block;
    text-align: center;
    margin-bottom: 20px;
  }

  .sort-filter button,
  .sort-filter select {
    width: 100%;
    margin-bottom: 10px;
  }

  .book-item {
    flex: 1 1 calc(50% - 20px);
    /* 2 columns on small screens */
  }
}

@media (max-width: 400px) {
  .hero-content {
    flex-direction: column;
    align-items: center;
  }

  .text-content h2 {
    font-size: 1.8em;
    /* Further reduce font size */
  }

  .book-item img {
    width: 80px;
    height: 120px;
    /* Smaller book images */
  }

  .book-item {
    flex: 1 1 100%;
    /* 1 column on very small screens */
  }

  .sort-filter {
    display: flex;
    flex-direction: column;
    /* Stack buttons in a column * /
    justify-content: center; /* Center them horizontally */
    gap: 1px;
    padding: 0;
    margin: 0;
    /* Add space above the buttons */
  }

  .sort-filter button {
    width: auto;
    /* Auto width for the buttons */
    padding: 10px 20px;
  }

  .bestsellers-header {
    text-align: center;
    /* Center align the "Bestsellers" heading */
    padding-top: 20px;
    /* Add space above the heading if necessary */
  }

  .bestsellers {
    text-align: center;
    /* Center align the content in the section */
  }
}

/* -------------------------------------------------- */
/* Medium-small screens (600px to 868px) */
@media (min-width: 600px) and (max-width: 970px) {

  .divider,
  .search-box {
    display: none;
    /* Hide the divider and search-box */
  }

  .sort-filter {
    display: flex;
    flex-direction: row;
    /* Keep them side by side */
    justify-content: center;
    /* Center horizontally */
    gap: 10px;
    margin-bottom: 20px;
    margin-top: 20px;
    /* Add some space above */
  }

  .bestsellers-header {
    flex-direction: column;
    /* Stack the buttons and heading vertically */
    align-items: center;
  }
}

/* ---------------------------------------------------------- */
@media (max-width: 950px) and (min-width: 678px) {
  .hero-content {
    flex-direction: column;
    /* Stack the heading and images vertically */
    align-items: center;
  }

  .text-content {
    text-align: center;
    /* Center the heading text */
    margin-bottom: 20px;
    /* Add spacing below the heading */
  }
}

/* ----------------------- */

/* Keep buttons horizontal for screens between 500px and 600px */
@media (max-width: 600px) and (min-width: 535px) {
  .sort-filter {
    display: flex;
    flex-direction: row;
    /* Keep buttons in a row */
    justify-content: center;
    /* Center them horizontally */
    gap: 10px;
    /* Adjust the gap between buttons */
    margin-bottom: 20px;
    margin-top: 10px;
  }

  .sort-filter button {
    padding: 10px 20px;
    font-size: 13px;
    /* Adjust font size for small screens */
  }
}

/* ------------------------------------------------ */
/* One column layout with larger images for screens 535px and below */
@media (max-width: 535px) {
  .book-item {
    flex: 1 1 100%;
    /* Display images in one column */
    margin: 0;
  }

  .book-item img {
    width: 100%;
    /* Set image width to 100% of its container */
    height: auto;
    /* Allow height to adjust automatically */
    max-width: 300px;
    /* Optionally, set a maximum width for the images */
    object-fit: cover;
    /* Ensure the images cover their containers */
  }

  .sort-filter {
    flex-direction: column;
    /* Stack buttons vertically */
    gap: 10px;
  }

  .sort-filter button {
    width: 100%;
    /* Make buttons full width */
    padding: 10px 20px;
    /* Adjust padding */
  }
}

/* ----------------------------------------- */
/* Hide book images in the hero section for screens between 320px and 410px */
@media (max-width: 410px) and (min-width: 320px) {
  .hero-content .book-slider {
    display: none;
    /* Hide the book images */
  }

  .hero-content {
    flex-direction: column;
    /* Stack the remaining content vertically */
    align-items: center;
    padding: 20px;
    /* Adjust padding for the hero section */
  }

  .text-content {
    max-width: 100%;
    /* Ensure the text takes full width */
    text-align: center;
    /* Center-align the text */
  }

  .text-content h2 {
    font-size: 2em;
    /* Adjust heading size for smaller screens */
    margin-bottom: 10px;
    /* Add some spacing */
  }

  .text-content p {
    font-size: 1em;
    /* Adjust paragraph font size */
    margin-bottom: 10px;
  }

  .text-content button {
    padding: 10px 20px;
    /* Adjust button padding */
    font-size: 1em;
  }
}

/* -------------------------------- */
/* Hide Sort and Genre buttons for screens 535px and below */
@media (max-width: 740px) {
  .sort-filter {
    display: none;
    /* Hides the Sort and Genre buttons */
  }
}

/* ------------------------------------ */
/* Medium screens: 740px to 600px */
@media (max-width: 740px) and (min-width: 600px) {
  .book-list {
    display: flex;
    flex-wrap: wrap;
    /* Ensure items can wrap to the next line */
    justify-content: space-between;
    /* Distribute space evenly */
  }

  .book-item {
    flex: 1 1 calc(33.33% - 20px);
    /* 3 columns with space between */
    margin: 10px 0;
    /* Optional: Add margin for spacing */
  }
}

@media screen and (max-width: 500px) {
  nav {
    display: none;
    /* This hides the navigation bar */
  }
}