* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Bengali", sans-serif;
  line-height: 1.6;
  color: #222;
  background-color: #f5f4f1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.site-header {
  background-color: #1a2744;
  color: #fff;
  padding: 2rem 2rem 1.75rem;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brand-main {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.75);
  margin-top: 0.15rem;
}

.brand-tagline {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.55);
  margin-top: 0.35rem;
}

/* ── Main ── */
.container {
  max-width: 1280px;
  width: 90%;
  margin: 0 auto;
  padding: 2.5rem 0;
  flex: 1;
}

/* ── Page heading ── */
.page-heading {
  margin-bottom: 2rem;
}

.page-heading h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a2744;
  margin-bottom: 0.3rem;
}

.page-heading p {
  font-size: 1rem;
  color: #666;
}

/* ── Toolbar ── */
.toolbar {
  margin-bottom: 1.5rem;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toolbar-row + .toolbar-row {
  margin-top: 0.75rem;
}

.toolbar-meta {
  justify-content: space-between;
}

.search-box {
  flex: 1;
  min-width: 0;
}

.search-box input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #333;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus {
  border-color: #1a2744;
}

.toolbar-selects {
  display: flex;
  gap: 0.5rem;
}

.toolbar-selects select {
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: inherit;
  color: #333;
  background: #fff;
  cursor: pointer;
  outline: none;
  max-width: 220px;
}

.toolbar-selects select:focus {
  border-color: #1a2744;
}

.result-count {
  font-size: 0.88rem;
  color: #666;
}

.btn-clear {
  padding: 0.45rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #666;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-clear:hover {
  border-color: #999;
  color: #333;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin-top: 2.5rem;
}

.page-btn {
  padding: 0.5rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #444;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  min-width: 2.4rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: #1a2744;
  background: #f4f6f9;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.page-active {
  background: #1a2744;
  color: #fff;
  border-color: #1a2744;
}

.page-active:hover {
  background: #1a2744;
  color: #fff;
}

.page-prev,
.page-next {
  font-weight: 500;
}

/* ── Book grid ── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

@media (min-width: 1500px) {
  .book-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

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

@media (max-width: 640px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* ── Book card ── */
.book-card {
  background: #fff;
  border: 1px solid #e8e5e0;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease;
}

.book-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

.card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #f0edeb;
  overflow: hidden;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}


.card-body {
  padding: 0.9rem 0.85rem 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  color: #1a2744;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-author {
  font-size: 0.8rem;
  color: #555;
  line-height: 1.35;
}

.card-publisher {
  font-size: 0.75rem;
  color: #888;
}

.card-meta {
  font-size: 0.75rem;
  color: #999;
  line-height: 1.4;
}

.card-price {
  margin-top: auto;
  padding-top: 0.4rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.price-current {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a2744;
}

.price-regular {
  font-size: 0.82rem;
  color: #999;
  text-decoration: line-through;
}

/* ── Loading skeleton ── */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

@media (min-width: 1500px) {
  .skeleton-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 1024px) {
  .skeleton-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .skeleton-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}

.skeleton-card {
  background: #fff;
  border: 1px solid #e8e5e0;
  border-radius: 4px;
  overflow: hidden;
}

.skeleton-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #e8e5e0;
  animation: pulse 1.4s ease-in-out infinite;
}

.skeleton-body {
  padding: 0.9rem 0.85rem 0.85rem;
}

.skeleton-line {
  height: 0.85rem;
  background: #e8e5e0;
  border-radius: 3px;
  margin-bottom: 0.55rem;
  animation: pulse 1.4s ease-in-out infinite;
}

.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Error / Empty ── */
.state-message {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}

.state-message h2 {
  font-size: 1.2rem;
  color: #444;
  margin-bottom: 0.5rem;
}

.state-message p {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.btn-retry {
  display: inline-block;
  padding: 0.55rem 1.5rem;
  background: #1a2744;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-retry:hover {
  background: #253b5e;
}

/* ── Footer ── */
.site-footer {
  background-color: #1a2744;
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 1.25rem;
  font-size: 0.82rem;
}

.site-footer span {
  color: rgba(255,255,255,0.4);
  font-size: 0.72rem;
  display: block;
  margin-top: 0.2rem;
}

/* ── Responsive adjustments ── */
@media (max-width: 640px) {
  .site-header {
    padding: 1.5rem 1.25rem 1.25rem;
  }

  .brand-main {
    font-size: 1.2rem;
  }

  .brand-sub {
    font-size: 0.8rem;
  }

  .container {
    width: 94%;
    padding: 1.5rem 0;
  }

  .page-heading h1 {
    font-size: 1.4rem;
  }

  .page-heading p {
    font-size: 0.9rem;
  }

  .card-title {
    font-size: 0.88rem;
  }

  .card-body {
    padding: 0.7rem 0.7rem 0.7rem;
  }

  .toolbar-selects {
    flex-wrap: wrap;
    width: 100%;
  }

  .toolbar-selects select {
    flex: 1;
    min-width: 130px;
    max-width: none;
  }

  .result-count {
    font-size: 0.82rem;
  }
}

@media (max-width: 360px) {
  .book-grid {
    gap: 0.65rem;
  }

  .card-title {
    font-size: 0.8rem;
  }

  .price-current {
    font-size: 0.9rem;
  }
}