/* ============================================================
   CATEGORY PAGE STYLES
   ============================================================ */

/* ---- Breadcrumb ---- */
.cat-breadcrumb {
  background: #f0f1f7;
  border-bottom: 1px solid #e4e5ee;
  padding: .6rem 0;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); transition: color var(--transition); }
.breadcrumb a:hover { color: #4169e1; }
.breadcrumb__sep { color: #bbb; }
.breadcrumb__current { color: var(--text); font-weight: 600; }

/* ---- Category Hero ---- */
.cat-hero {
  background: linear-gradient(120deg, #2a3f8f 0%, #4169e1 100%);
  padding: 2rem 0;
  color: #fff;
}
.cat-hero__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.cat-hero__title { font-size: 2rem; font-weight: 800; margin-bottom: .35rem; }
.cat-hero__sub { font-size: .88rem; opacity: .75; margin-bottom: 1.1rem; }
.cat-hero__tags { display: flex; gap: .5rem; flex-wrap: wrap; }
.cat-tag {
  padding: .3rem .85rem;
  border-radius: 9999px;
  font-size: .78rem;
  font-weight: 600;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  text-decoration: none;
  transition: background var(--transition);
}
.cat-tag:hover { background: rgba(255,255,255,.25); }
.cat-tag--active { background: #fff; color: #4169e1; border-color: #fff; }

.cat-hero__right { display: flex; gap: 2rem; flex-shrink: 0; }
.cat-stat { text-align: center; }
.cat-stat__num { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.cat-stat__label { font-size: .72rem; opacity: .7; }

/* ---- Layout ---- */
.cat-page { background: #f7f8fc; min-height: 100vh; }
.cat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  align-items: start;
}

/* ---- Sidebar ---- */
.cat-sidebar {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e4e5ee;
  padding: 1.1rem;
  position: sticky;
  top: calc(var(--header-h) + 12px);
}
.cat-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid #eee;
}
.cat-filter-reset {
  font-size: .75rem;
  color: #4169e1;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}
.cat-filter-reset:hover { text-decoration: underline; }

/* Filter group */
.cat-filter-group { border-bottom: 1px solid #f0f1f7; }
.cat-filter-group:last-child { border-bottom: none; }
.cat-filter-group__title {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  padding: .75rem 0;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.cat-filter-group__title svg {
  width: 16px;
  height: 16px;
  stroke: #999;
  transition: transform var(--transition);
  flex-shrink: 0;
}
.cat-filter-group__title.open svg { transform: rotate(180deg); }
.cat-filter-group__body {
  padding-bottom: .75rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.cat-filter-group__body.collapsed { display: none; }

/* Checkbox / radio */
.cat-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: var(--text);
  cursor: pointer;
}
.cat-check input { accent-color: #4169e1; width: 15px; height: 15px; flex-shrink: 0; }
.cat-check span:first-of-type { flex: 1; }
.cat-check__count { font-size: .72rem; color: var(--text-muted); }
.cat-check--star span { color: #f4a261; }

/* Price range */
.cat-range__inputs {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .5rem;
}
.cat-range__input {
  width: 60px;
  padding: .3rem .4rem;
  border: 1px solid #e4e5ee;
  border-radius: 6px;
  font-size: .8rem;
  font-family: var(--font);
  color: var(--text);
  background: #f5f6fa;
  text-align: center;
}
.cat-range__input:focus { outline: none; border-color: #4169e1; }
.cat-range__currency { font-size: .8rem; color: var(--text-muted); }
.cat-range__slider {
  width: 100%;
  accent-color: #4169e1;
  margin-bottom: .5rem;
}

/* ---- Toolbar ---- */
.cat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #e4e5ee;
  border-radius: 10px;
  padding: .75rem 1rem;
  margin-bottom: 1.1rem;
}
.cat-toolbar__left { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.cat-toolbar__right { display: flex; align-items: center; gap: .6rem; }
.cat-toolbar__count { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.cat-toolbar__count strong { color: var(--text); }

/* Active filter chips */
.cat-active-filters { display: flex; gap: .4rem; flex-wrap: wrap; }
.cat-active-filter {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #eef0fa;
  border: 1px solid #c5cbee;
  color: #4169e1;
  border-radius: 9999px;
  padding: .15rem .6rem;
  font-size: .75rem;
  font-weight: 600;
}
.cat-active-filter__remove {
  background: none;
  border: none;
  color: #4169e1;
  cursor: pointer;
  font-size: .7rem;
  padding: 0;
  line-height: 1;
}

/* View toggle */
.cat-view-toggle { display: flex; gap: 2px; }
.cat-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #e4e5ee;
  background: #f5f6fa;
  cursor: pointer;
  transition: all var(--transition);
  color: #888;
}
.cat-view-btn svg { width: 15px; height: 15px; }
.cat-view-btn.active, .cat-view-btn:hover { background: #4169e1; border-color: #4169e1; color: #fff; }
.cat-view-btn.active svg, .cat-view-btn:hover svg { stroke: #fff; }

/* Sort select */
.cat-sort {
  padding: .35rem .75rem;
  border: 1px solid #e4e5ee;
  border-radius: 8px;
  font-size: .82rem;
  font-family: var(--font);
  background: #f5f6fa;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition);
}
.cat-sort:focus { outline: none; border-color: #4169e1; }

/* Mobile filter button */
.cat-mobile-filter-btn {
  display: none;
  align-items: center;
  gap: .4rem;
  padding: .35rem .75rem;
  border: 1px solid #e4e5ee;
  border-radius: 8px;
  background: #f5f6fa;
  font-size: .82rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.cat-mobile-filter-btn svg { width: 15px; height: 15px; stroke: var(--text); }

/* ---- Book Grid ---- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}
.cat-grid .book-card {
  width: 100%;
}
.cat-grid .book-card__img-wrap {
  aspect-ratio: 2/3;
  height: auto;
}

/* List view */
.cat-grid.list-view {
  grid-template-columns: 1fr;
}
.cat-grid.list-view .book-card {
  flex-direction: row;
  max-height: 160px;
}
.cat-grid.list-view .book-card__img-wrap {
  width: 100px;
  flex-shrink: 0;
}
.cat-grid.list-view .book-card__img-wrap img {
  height: 100%;
  object-fit: cover;
}

/* Badge variants */
.book-card__badge {
  position: absolute;
  top: .45rem;
  left: .45rem;
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 4px;
  color: #fff;
  pointer-events: none;
}
.book-card__badge--discount { background: #e63946; }
.book-card__badge--new { background: #4169e1; }
.book-card__badge--bestseller { background: #f4a261; color: #fff; }

/* Old price */
.book-card__old-price {
  font-size: .72rem;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-left: .25rem;
}

/* ---- Pagination ---- */
.cat-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin-top: 2rem;
  padding-bottom: 1rem;
}
.cat-page-btn {
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e4e5ee;
  background: #fff;
  font-size: .85rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 .5rem;
  transition: all var(--transition);
}
.cat-page-btn:hover:not(:disabled):not(.active) { border-color: #4169e1; color: #4169e1; }
.cat-page-btn.active { background: #4169e1; border-color: #4169e1; color: #fff; }
.cat-page-btn:disabled { opacity: .35; cursor: default; }
.cat-page-btn--prev svg, .cat-page-btn--next svg { width: 16px; height: 16px; }
.cat-page-ellipsis { color: var(--text-muted); padding: 0 .2rem; }

/* ---- Sidebar overlay (mobile) ---- */
.cat-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
}
.cat-sidebar-overlay.active { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .cat-layout { grid-template-columns: 200px 1fr; gap: 1rem; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .cat-hero__title { font-size: 1.4rem; }
  .cat-hero__right { gap: 1.25rem; }
  .cat-stat__num { font-size: 1.2rem; }

  .cat-layout { grid-template-columns: 1fr; }

  .cat-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    border-radius: 0;
    transition: left .3s ease;
    padding: 1.5rem 1.25rem;
  }
  .cat-sidebar.open { left: 0; }

  .cat-mobile-filter-btn { display: flex; }

  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: .65rem; }
  .cat-grid .book-card__body { padding: .55rem; }
  .cat-grid .book-card__title { font-size: .8rem; }
  .cat-grid .book-card__author { font-size: .7rem; }
  .cat-grid .book-card__price { font-size: .88rem; }
  .cat-grid .book-card__cart-btn { width: 28px; height: 28px; }

  .cat-toolbar { padding: .6rem .75rem; }
  .cat-toolbar__left { gap: .5rem; }
  .cat-toolbar__count { font-size: .78rem; }
}

@media (max-width: 480px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .cat-grid .book-card__body { padding: .45rem; }
  .cat-hero__inner { flex-direction: column; gap: 1rem; }
  .cat-hero__right { width: 100%; justify-content: space-around; }
}
