/*
  category.css
  BenQ Bangladesh — Product Category Page
  Dedicated stylesheet for pages/category.html only: page header,
  sidebar filters (category + price, with a mobile slide-in drawer),
  toolbar (result count, sort, grid/list view toggle), active-filter
  chips, product grid/list, empty state, and pagination.

  Depends on the design tokens in css/style.css and the
  .pf-product-card / .pf-btn / .pd-breadcrumb styles from
  css/components.css and css/product.css, which this page reuses
  for visual consistency with the rest of the site.
*/

/* ============ PAGE HEADER ============ */
.cat-header{
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 12px var(--container-pad) 28px;
}

.cat-header h1{
  font-family: var(--font-display);
  font-size: clamp(26px, 3.4vw, 36px);
  color: var(--ink);
  margin: 0 0 8px;
}

.cat-header p{
  font-family: var(--font-body);
  font-size: 15.5px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 640px;
}

/* ============ LAYOUT ============ */
.cat-layout{
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad) 72px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  align-items: start;
}

.cat-filter-toggle{
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 4px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.cat-filter-toggle svg{ width: 18px; height: 18px; flex-shrink: 0; }

.cat-filter-toggle-count{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-purple);
  color: var(--white-color);
  font-size: 11.5px;
  font-weight: 700;
}

/* ============ SIDEBAR ============ */
.cat-sidebar{
  position: sticky;
  top: 90px;
}

.cat-sidebar-head{
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cat-sidebar-head h2{
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--ink);
  margin: 0;
}

.cat-sidebar-close{
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px;
}

.cat-filter-group{
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.cat-filter-group:first-of-type{ padding-top: 0; }

.cat-filter-group h3{
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--ink);
  margin: 0 0 14px;
}

.cat-filter-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cat-checkbox{
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-soft);
}

.cat-checkbox input{
  width: 16px;
  height: 16px;
  accent-color: var(--brand-purple);
  cursor: pointer;
  flex-shrink: 0;
}

.cat-checkbox span:nth-of-type(1){ flex: 1; }

.cat-checkbox:hover{ color: var(--ink); }

.cat-checkbox-count{
  font-size: 12.5px;
  color: var(--ink-soft);
}

.cat-clear-btn{
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}

.cat-clear-btn:hover{
  border-color: var(--brand-purple);
  color: var(--brand-purple);
}

.cat-apply-btn{
  display: none;
  width: 100%;
  margin-top: 12px;
  padding: 13px 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand-purple);
  color: var(--white-color);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.cat-sidebar-overlay{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,27,31,.45);
  z-index: 200;
  opacity: 0;
  transition: opacity .25s ease;
}

.cat-sidebar-overlay.open{ display: block; opacity: 1; }

/* ============ TOOLBAR ============ */
.cat-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.cat-result-count{
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-soft);
}

.cat-toolbar-right{
  display: flex;
  align-items: center;
  gap: 14px;
}

.cat-sort-label{
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink-soft);
}

.cat-sort-select{
  padding: 9px 32px 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355505E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
}

.cat-view-toggle{
  display: flex;
  gap: 4px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 3px;
}

.cat-view-btn{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.cat-view-btn svg{ width: 16px; height: 16px; }

.cat-view-btn.active{
  background: var(--brand-purple);
  color: var(--white-color);
}

/* ============ ACTIVE FILTER CHIPS ============ */
.cat-active-filters{
  display: none;
  flex-wrap: wrap;
  gap: 10px;
  margin: -8px 0 24px;
}

.cat-chip{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.cat-chip span{ font-size: 15px; line-height: 1; color: var(--ink-soft); }

.cat-chip:hover{ border-color: var(--brand-purple); }

.cat-chip-clear{
  border: none;
  background: none;
  color: var(--brand-purple);
  text-decoration: underline;
  padding: 7px 4px;
}

/* ============ PRODUCT GRID / LIST ============ */
.cat-products-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.cat-products-grid .pf-product-card{ margin: 0; }

/* List view: reflow each card into image-left / content-right via
   CSS Grid auto-placement — the thumb spans every row in column 1,
   and the untouched sibling elements (tag, name, desc, price,
   actions) auto-flow into column 2 in their existing DOM order. */
.cat-products-grid.list-view{
  grid-template-columns: 1fr;
  gap: 16px;
}

.cat-products-grid.list-view .pf-product-card{
  display: grid;
  grid-template-columns: 200px 1fr;
  column-gap: 24px;
  align-items: start;
}

.cat-products-grid.list-view .pf-product-thumb-link{
  grid-column: 1;
  grid-row: 1 / -1;
}

.cat-products-grid.list-view .pf-product-thumb{ margin-bottom: 0; }

.cat-products-grid.list-view .pf-product-name{ margin-top: 4px; }

.cat-products-grid.list-view .pf-product-actions{
  flex: none;
  max-width: 360px;
}

/* ============ EMPTY STATE ============ */
.cat-empty{
  text-align: center;
  padding: 72px 20px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
}

.cat-empty h3{
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
  margin: 0 0 8px;
}

.cat-empty p{
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.cat-empty .pf-btn{
  display: inline-flex;
  width: auto;
  padding: 12px 28px;
}

/* ============ PAGINATION ============ */
.cat-pagination{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}

.cat-page-btn{
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.cat-page-btn:hover:not(:disabled):not(.active){
  border-color: var(--brand-purple);
  color: var(--brand-purple);
}

.cat-page-btn.active{
  background: var(--brand-purple);
  border-color: var(--brand-purple);
  color: var(--white-color);
}

.cat-page-btn:disabled{
  opacity: .35;
  cursor: not-allowed;
}


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

@media (max-width: 900px){
  .cat-layout{ grid-template-columns: 1fr; }
  .cat-filter-toggle{ display: flex; }

  .cat-sidebar{
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 86vw);
    background: var(--paper);
    z-index: 201;
    padding: 20px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .3s ease;
  }

  .cat-sidebar.open{ transform: translateX(0); }
  .cat-sidebar-head{ display: flex; }
  .cat-apply-btn{ display: block; }

  .cat-products-grid{ grid-template-columns: repeat(2, 1fr); }

  .cat-products-grid.list-view .pf-product-card{
    grid-template-columns: 140px 1fr;
    column-gap: 16px;
  }
}

@media (max-width: 640px){
  .cat-toolbar{ flex-direction: column; align-items: stretch; }
  .cat-toolbar-right{ justify-content: space-between; }
  .cat-products-grid{ grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

@media (max-width: 480px){
  .cat-header{ padding-bottom: 20px; }
  .cat-layout{ padding-bottom: 56px; }
  .cat-products-grid{ grid-template-columns: 1fr; }

  .cat-products-grid.list-view .pf-product-card{
    grid-template-columns: 1fr;
  }
  .cat-products-grid.list-view .pf-product-thumb-link{
    grid-column: 1;
    grid-row: auto;
  }

  .cat-pagination{ flex-wrap: wrap; }
}
