@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');


.inner-body {
  margin: 0;
  margin-top: 10px;
  background-color: white;
  border-radius: 30px;
  padding: 30px 20px;
  /* max-width: 1200px; */
  margin-left: 40px;
  margin-right: 40px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-content: center;
  justify-items: center;
  text-align: center;
}
@media (max-width: 600px) {
  .inner-body {
    padding: 20px;
    margin: 0;
  }
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  background: rgba(255,255,255,0.07);
  border-radius: 12px;
  padding: 10px 0;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#categorySelect {
  padding: 12px 18px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #cfd8dc;
  max-width: 220px;
  background: #f5fafd;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  transition: border 0.2s;
}

#categorySelect:focus {
  border: 1.5px solid #008793;
  outline: none;
}

.header input {
  flex: 1;
  min-width: 120px;
}

.compact-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: white;
  font-weight: 500;
  margin-left: 0;
}

/* Custom switch style */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  vertical-align: middle;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cfd8dc;
  border-radius: 22px;
  transition: .3s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
input:checked + .slider {
  background-color: #008793;
}
input:checked + .slider:before {
  transform: translateX(16px);
}

main {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* ✅ 4 cards per row by default */
  gap: 28px;
  padding: 2.5rem 2rem 1rem 2rem;
  min-height: 300px;
  transition: all 0.2s;
}

.no-results {
  width: 100%;
  text-align: center;
  color: #004d7a;
  font-size: 1.3rem;
  margin: 2.5rem 0 2rem 0;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  min-height: 180px;
}

/* Card styles */
.card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.10);
  overflow: hidden;
  text-align: left;
  transition: transform 0.22s cubic-bezier(.4,2,.6,1), box-shadow 0.22s;
  display: flex;
  flex-direction: column;
  min-height: 390px;
  position: relative;
  border: 1px solid #e3ecf7;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-7px) scale(1.025);
  box-shadow: 0 10px 36px rgba(0,0,0,0.13);
  border-color: #fbbf24;
}

.card-img-wrapper {
  width: 100%;
  height: auto;
  background: #f5fafd;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-bottom: 1px solid #f0f0f0;
  background: #e3ecf7;
  transition: filter 0.2s;
  display: block;
  border-radius: 0;
}
.card h3 {
  margin: 18px 16px 8px 16px;
  font-size: 1.13rem;
  font-weight: 700;
  color: #1f2937;
  min-height: 44px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.card p {
  margin: 0 16px 18px 16px;
  font-size: 1rem;
  color: #6b7280;
  min-height: 20px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.duration-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: rgba(0,77,122,0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px 4px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  z-index: 2;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.compact .card-img-wrapper {
  height: 100%;
  min-width: 70px;
  max-width: 110px;
}
.compact .duration-badge {
  font-size: 11px;
  padding: 3px 8px 3px 7px;
  right: 7px;
  bottom: 7px;
}

/* --- Compact Card Professional Layout --- */
/* ✅ Compact view on desktop: 2 per row */
.compact main {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 18px;
  padding: 2rem 1rem 1rem 1rem;
}
.compact .card {
  flex-direction: row;
  align-items: stretch;
  min-height: 120px;
  height: 120px;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  border-radius: 16px;
  overflow: hidden;
  background: white;
  border: 1px solid #e3ecf7;
  transition: box-shadow 0.18s;
}
.compact .card-img-wrapper {
  width: 120px;
  min-width: 120px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e3ecf7;
  position: relative;
  border-radius: 16px 0 0 16px;
  overflow: hidden;
}
.compact .card img {
  width: 120px;
  height: 100%;
  object-fit: cover;
  border-radius: 16px 0 0 16px;
  border: none;
}
.compact .card-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 18px;
  flex: 1;
  min-width: 0;
  gap: 2px;
}
.compact .card h3 {
  font-size: 16px;
  margin: 0 0 4px 0;
  color: #1f2937;
  font-weight: 600;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.compact .card p {
  font-size: 13px;
  margin: 0 0 6px 0;
  color: #6b7280;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.compact-text {
  color: black;
}
#searchInput {
  width: 100%;
  max-width: 300px;
  margin-right: 10px;
  padding: 8px 10px;
}
#bookContainer a{
    text-align: center;
    text-decoration: none;
}

/* --- Improved header controls for user-friendly look --- */
.books-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
  padding: 0 0 10px 0;
  border-bottom: 1.5px solid #fbbf24;
}

.books-header-row h1 {
  font-size: 2.1rem;
  font-weight: 800;
  color: #004d7a;
  margin: 0;
  letter-spacing: 0.5px;
}

.books-header-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: #f5fafd;
  border-radius: 18px;
  padding: 10px 18px;
  box-shadow: 0 2px 8px rgba(0,77,122,0.04);
}

#searchInput {
  width: 220px;
  max-width: 100%;
  padding: 9px 14px;
  border-radius: 14px;
  border: 1.5px solid #e3ecf7;
  font-size: 1rem;
  background: #fff;
  color: #222;
  transition: border 0.2s;
  outline: none;
}

#searchInput:focus {
  border: 1.5px solid #fbbf24;
  background: #fdf6e3;
}

#categorySelect {
  padding: 9px 14px;
  border-radius: 14px;
  border: 1.5px solid #e3ecf7;
  font-size: 1rem;
  background: #fff;
  color: #222;
  transition: border 0.2s;
  outline: none;
  min-width: 140px;
}

#categorySelect:focus {
  border: 1.5px solid #fbbf24;
  background: #fdf6e3;
}

.compact-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1rem;
  color: #004d7a;
  font-weight: 600;
  background: #fffbe7;
  border-radius: 12px;
  padding: 5px 12px;
  border: 1px solid #fbbf24;
}

.compact-text {
  color: #004d7a;
  font-weight: 600;
  margin: 0;
  font-size: 1rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  vertical-align: middle;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #e3ecf7;
  border-radius: 20px;
  transition: .3s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
input:checked + .slider {
  background-color: #fbbf24;
}
input:checked + .slider:before {
  transform: translateX(16px);
}

/* --- Responsive improvements for header controls --- */
@media (max-width: 900px) {
  .books-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 0 0 8px 0;
  }
  .books-header-controls {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 8px;
  }
  #searchInput, #categorySelect {
    width: 100%;
    min-width: 0;
    flex: 1 1 10px;
  }
}

@media (max-width: 600px) {
  .books-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 0 0 6px 0;
  }
  .books-header-row h1 {
    font-size: 1.3rem;
    margin-bottom: 2px;
  }
  .books-header-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 7px 4px;
    border-radius: 12px;
  }
  #searchInput, #categorySelect {
    width: 100%;
    font-size: 0.98rem;
    padding: 8px 10px;
    border-radius: 10px;
  }
  .compact-switch {
    justify-content: flex-start;
    padding: 4px 8px;
    font-size: 0.97rem;
    border-radius: 8px;
  }
}

@media (max-width: 900px) {
  main {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px;
    padding: 1.5rem 0.5rem 1rem 0.5rem;
  }

  .card {
    max-width: 99vw;
    min-width: 0;
  }

  .compact main {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 600px) {
  main {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
    padding: 1rem 0.2rem 1rem 0.2rem;
  }

  .compact main {
    grid-template-columns: 1fr !important;
    gap: 10px;
    padding: 1rem 0.2rem 1rem 0.2rem;
  }

  .card {
    max-width: 100vw;
    min-width: 0;
    margin: 0 auto;
    min-height: 340px;
    border-radius: 14px;
  }

  .card-img-wrapper {
    height: 180px;
    border-radius: 14px 14px 0 0;
  }

  .card img {
    height: 180px;
    border-radius: 14px 14px 0 0;
  }

  .card h3 {
    font-size: 1.05rem;
    margin: 14px 10px 6px 10px;
    min-height: 36px;
  }

  .card p {
    font-size: 0.97rem;
    margin: 0 10px 14px 10px;
    min-height: 18px;
  }

  .duration-badge {
    font-size: 12px;
    padding: 3px 8px 3px 7px;
    right: 8px;
    bottom: 8px;
  }

  .compact main {
    grid-template-columns: 1fr !important;
    gap: 10px;
    padding: 1rem 0.2rem 1rem 0.2rem;
  }

  .compact .card {
    max-width: 100vw;
    min-height: 100px;
    height: 100px;
    border-radius: 12px;
  }

  .compact .card-img-wrapper {
    width: 90px;
    min-width: 90px;
    height: 100%;
    border-radius: 12px 0 0 12px;
  }

  .compact .card img {
    width: 90px;
    border-radius: 12px 0 0 12px;
  }

  .compact .card-content {
    padding: 0 10px;
  }
}

/* --- User-friendly improvements --- */
.card {
  transition: box-shadow 0.22s, transform 0.22s;
}
.card:focus-within, .card:active {
  box-shadow: 0 0 0 3px #fbbf24;
  outline: none;
}
.card h3, .card p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card h3 {
  transition: color 0.2s;
}
.card:hover h3 {
  color: #a47600;
}
.card a {
  text-decoration: none;
  color: inherit;
}
/* --- Pagination Styles --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  flex-wrap: wrap;
  user-select: none;
  border-radius: 12px;
  padding: 10px;
  flex-direction: column; /* Stacks children vertically for all devices */
}

.pagination-nav-container {
  display: flex;
  width: 100%;
  gap: 0;
  justify-content: space-between;
}

.pagination-large-btn {
  background-color: #2b2d31;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  flex-grow: 1;
  flex-basis: 50%;
  justify-content: center;
}

.pagination-large-btn.prev-btn {
  color: #fff;
}

.pagination-large-btn.next-btn {
  background-color: #f7a92b;
  color: #000000;
  font-weight: 700;
  transition: box-shadow 0.2s ease;
}

.pagination-large-btn:hover:not([disabled]) {
  background-color: #3f4247;
}

.pagination-large-btn.next-btn:hover:not([disabled]) {
  background-color: #f7a92b;
  box-shadow: 0 0 10px black;
}

.pagination-large-btn:disabled {
  color: #8c8c8c;
  cursor: not-allowed;
  background-color: #2b2d31;
}

.pagination-number-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.pagination-number {
  background-color: #535456;
  color: #fff;
  border: none;
  padding: 10px 0.8em; /* Adjusted padding to be relative to font size */
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  min-width: 2.2em; /* Adjusted min-width to be relative to font size */
  font-weight: 500;
  text-align: center;
}

.pagination-number.active {
  background-color: #4a4d52;
  font-weight: 700;
}

.pagination-number:hover:not(.active) {
  background-color: #3f4247;
}

.pagination-ellipsis {
  color: #8c8c8c;
  padding: 0 4px;
  user-select: none;
}

/* Optional: Add a subtle glow on focus for accessibility */
.pagination-large-btn:focus,
.pagination-number:focus {
  outline: 2px solid #5a5a5a;
  outline-offset: 2px;
}

/* --- Responsive Pagination for Mobile/Tablet --- */
@media (max-width: 790px) {
  .pagination-number {
    padding: 8px 0.6em; /* Reduced padding */
    font-size: 0.9rem; /* Reduced font size */
    min-width: 2em;
  }
}

/* Add a media query for smaller phones */
@media (max-width: 480px) {
  .pagination-number-container {
    gap: 4px; /* Reduced gap between numbers */
  }

  .pagination-number {
    padding: 6px 0.5em; /* Further reduced padding */
    font-size: 0.85rem; /* Further reduced font size */
    min-width: 1.8em;
  }
}

/* --- End of update --- */