:root {
  --primary: #f95f6c;
  --primary-dark: #ef4f5d;
  --accent: #12a58a;
  --bg: #f3f3f3;
  --panel: #ffffff;
  --text: #2a2a2a;
  --muted: #7a7a7a;
  --line: #e5e5e5;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* ===== Top Bar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 26px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}

.brand-text {
  line-height: 1.1;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.brand-sub {
  font-size: 11px;
  opacity: 0.9;
}

.search {
  flex: 1;
  max-width: 620px;
  display: flex;
  align-items: stretch;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}

.search input {
  flex: 1;
  border: 0;
  outline: 0;
  padding: 12px 14px;
  font-size: 14px;
  background: #fff;
}

.search button {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
}

.search button:hover {
  background: #0f927a;
}

.actions {
  display: flex;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

button.secondary {
  background: #fff;
  color: var(--primary-dark);
}

button.secondary:hover {
  background: #ffeef0;
}

/* ===== Hero Banner ===== */
.content::before {
  content: "";
  display: block;
  width: 100%;
  height: 260px;
  border-radius: 14px;
  margin-bottom: 24px;
  background:
    linear-gradient(rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.28)),
    url("https://images.unsplash.com/photo-1507842217343-583bb7270b66?auto=format&fit=crop&w=1400&q=80")
    center/cover no-repeat;
  box-shadow: var(--shadow);
}

/* Overlay-style title text on hero */
.content {
  position: relative;
}

.content-head {
  position: absolute;
  top: 38px;
  left: 34px;
  right: 34px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  color: #fff;
}

.results-title {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.3px;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
  max-width: 560px;
}

.controls {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.controls select {
  border: 0;
  outline: 0;
  background: rgba(255, 255, 255, 0.92);
  color: #333;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

/* ===== Main Layout ===== */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
  padding: 22px;
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar {
  background: var(--panel);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 88px;
}

.sidebar-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 14px;
  font-weight: 700;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.category-caret {
  width: 16px;
  color: var(--muted);
  flex: 0 0 16px;
}

.category-item.child {
  padding-left: 18px;
}

.category-item.child .category-caret {
  display: none;
}

.category-list button,
.category-list .category-item {
  width: 100%;
  text-align: left;
  background: #fafafa;
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 8px;
  color: #444;
  font-size: 14px;
}

.category-list button:hover,
.category-list .category-item:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #fff5f6;
}

.category-item.active {
  border-color: var(--primary);
  background: #fff5f6;
}

/* ===== Grid Section ===== */
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
  margin-top: 6px;
}

.meta {
  color: var(--muted);
}

/* Card */
.book-card {
  display: block;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none;
  color: inherit;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #ddd center/cover no-repeat;
  display: block;
}

.book-info {
  padding: 12px;
}

.book-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 6px;
  min-height: 38px;
}

.book-author {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.book-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #666;
}

.book-price {
  color: #f25555;
  font-weight: 700;
}

.book-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.book-actions .btn {
  flex: 1;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #333;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}

.book-actions .btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #fff5f6;
}

.book-actions .btn.secondary {
  border-color: var(--accent);
  background: rgba(18, 165, 138, 0.08);
}

.book-actions .btn.secondary:hover {
  background: rgba(18, 165, 138, 0.14);
}

/* ===== Pager ===== */
.pager {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-bottom: 14px;
}

.page-info {
  min-width: 120px;
  text-align: center;
  font-weight: 700;
  color: #555;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #222;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .content::before {
    height: 220px;
  }

  .results-title {
    font-size: 34px;
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    padding: 14px;
  }

  .brand {
    min-width: auto;
  }

  .search {
    order: 3;
    width: 100%;
    max-width: 100%;
  }

  .layout {
    padding: 14px;
  }

  .content::before {
    height: 180px;
  }

  .content-head {
    top: 24px;
    left: 20px;
    right: 20px;
  }

  .results-title {
    font-size: 24px;
    max-width: 100%;
  }

  .controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .controls select {
    flex: 1 1 120px;
  }

  #grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
}
