/* ==========================================================================
   CATEGORY / ARCHIVE PAGE — product listing with filters
   Reuses tokens/chrome from pdp.css
   ========================================================================== */

/* ---------- breadcrumb ---------- */
.crumbs { margin: 16px 0 8px; }
.crumbs__list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; font-size: 13px; color: var(--muted); }
.crumbs__list li { display: flex; align-items: center; gap: 8px; }
.crumbs__list li:not(:last-child)::after { content: "/"; color: var(--line); }
.crumbs__list a { color: var(--ink-2); text-decoration: none; }
.crumbs__list a:hover { color: var(--blue); text-decoration: underline; }
.crumbs__list [aria-current] { color: var(--ink); font-weight: 500; }

/* ---------- page header ---------- */
.page-head { margin: 20px 0 24px; }
.page-head .eyebrow { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.page-head h1 { margin: 0 0 6px; font-family: var(--fd); font-size: clamp(28px, 3.2vw, 40px); font-weight: 700; letter-spacing: -.02em; }
.page-head__count { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- catalog layout ---------- */
.catalog { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 16px; }

/* ---------- filters sidebar ---------- */
.filters { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; padding: 20px; background: #fbfbfc; border: 1px solid var(--line); border-radius: 14px; }
.filters__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.filters__head h2 { margin: 0; font-family: var(--fd); font-size: 17px; font-weight: 600; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.icon-btn:hover { border-color: var(--ink); }

.filter-group { margin-bottom: 20px; }
.filter-group__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.filter-group__head h3 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.filter-group__toggle { display: none; width: 28px; height: 28px; place-items: center; border: 0; background: transparent; color: var(--ink); }
.filter-group__body { display: flex; flex-direction: column; gap: 8px; }

.filter-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 13px; transition: background .1s, color .1s; }
.filter-option:hover { background: #f1f3f6; color: var(--ink); }
.filter-option.is-active { background: #eef3fb; color: var(--blue); font-weight: 600; }
.filter-option input[type="checkbox"] { accent-color: var(--blue); width: 16px; height: 16px; margin-right: 8px; }
.filter-option__count { font-size: 12px; color: var(--muted); font-weight: 400; }
.filter-option.is-active .filter-option__count { color: var(--blue); }

.price-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.price-input { width: 70px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; color: var(--ink); }
.price-input:focus { outline: none; border-color: var(--blue); }
.price-apply { height: 36px; }

.filters__apply { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.filters__apply .btn { width: 100%; }

/* ---------- catalog main ---------- */
.catalog__bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; padding: 12px 16px; background: #fbfbfc; border: 1px solid var(--line); border-radius: 12px; }
.catalog__count { font-size: 13.5px; color: var(--muted); }

.catalog__tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.filter-toggle { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.filter-toggle:hover { border-color: var(--ink); color: var(--ink); }
.filter-toggle svg { width: 18px; height: 18px; }

.sort-select { position: relative; }
.sort-select__native { appearance: none; height: 40px; padding: 0 40px 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; font-family: inherit; color: var(--ink); cursor: pointer; }
.sort-select__native:focus { outline: none; border-color: var(--blue); }
.sort-select__icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }

.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-btn { width: 40px; height: 40px; display: grid; place-items: center; background: #fff; border: 0; color: var(--muted); }
.view-btn:hover { background: #f5f6f8; color: var(--ink); }
.view-btn.is-active { background: #eef3fb; color: var(--blue); }
.view-btn svg { width: 20px; height: 20px; }

/* ---------- product grid ---------- */
.grid-products { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-products[data-view="list"] { grid-template-columns: 1fr; }

/* Product card (reused from PDP content-product.php) */
.prod { display: grid; grid-template-rows: auto 1fr auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.grid-products[data-view="list"] .prod { grid-template-columns: 160px 1fr; grid-template-rows: auto; }
.prod:hover { border-color: var(--faint); box-shadow: 0 12px 28px rgba(15,23,42,.08); transform: translateY(-2px); }

.prod__media { position: relative; display: block; aspect-ratio: 1 / 1; background: #f6f7fa; overflow: hidden; }
.grid-products[data-view="list"] .prod__media { aspect-ratio: auto; height: 100%; min-height: 160px; width: 160px; }
.prod__media img { width: 100%; height: 100%; object-fit: contain; padding: 16px; mix-blend-mode: multiply; transition: transform .3s ease; }
.prod:hover .prod__media img { transform: scale(1.03); }

.prod__badges { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.badge--blue { background: #eef3fb; color: var(--blue); }
.badge--sale { background: #ffecec; color: #c0392b; }

.prod__compare { position: absolute; bottom: 8px; right: 8px; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); opacity: 0; transition: opacity .15s, color .15s; }
.prod:hover .prod__compare { opacity: 1; }
.prod__compare:hover { color: var(--blue); border-color: var(--blue); }
.prod__compare svg { width: 18px; height: 18px; }

.prod__body { display: grid; gap: 6px; padding: 14px; }
.prod__cats { display: inline-block; font-size: 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod__name { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod__specs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.prod__specs span { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; color: var(--muted); background: #fbfbfc; }

.prod__price-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.prod__price-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.prod__price { font-family: var(--fd); font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.prod__old { font-size: 13.5px; color: var(--muted); text-decoration: line-through; }

/* #8-style card: brand row, KOKO installment line, stock dot */
.prod__brand { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; color: #8a94a3; text-transform: uppercase; margin-bottom: 4px; }
.prod__koko { display: flex; align-items: center; gap: 8px; margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.prod__koko .koko-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .05em; color: var(--blue); background: #eef1fb; border: 1px solid #d9e1f5; padding: 2px 6px; border-radius: 4px; }
.prod__stock { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.prod__stock .stock-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }

.prod__buttons { display: flex; gap: 8px; margin-top: 4px; }
.prod__wish { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); transition: color .15s, border-color .15s; }
.prod__wish:hover { color: #c0392b; border-color: #c0392b; }
.prod__wish svg { width: 20px; height: 20px; }

.prod__meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.prod__meta b { font-weight: 600; color: var(--ink-2); }
.prod__meta span { font-size: 11.5px; }

/* Button styles (reused from pdp) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 8px; font-size: 13.5px; font-weight: 600; font-family: inherit; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn--sm { height: 36px; padding: 0 14px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn--ink { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn--ink:hover { background: #13213f; border-color: #13213f; }
.btn--gold { background: var(--gold); color: #241a05; border: 1px solid var(--gold); }
.btn--gold:hover { background: #c9a45f; border-color: #c9a45f; }
.btn--outline { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn--outline:hover { border-color: var(--ink); color: var(--ink); }
.ajax_add_to_cart { cursor: pointer; }

.prod__buy { width: 100%; margin-top: 8px; }

/* List view adjustments */
.grid-products[data-view="list"] .prod__body { grid-column: 2; }
.grid-products[data-view="list"] .prod__media { border-right: 1px solid var(--line); }
.grid-products[data-view="list"] .prod__price { font-size: 18px; }
.grid-products[data-view="list"] .prod__buy { width: auto; min-width: 160px; }

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 36px; }
.pagination__btn { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.pagination__btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.pagination__btn:disabled, .pagination__btn.is-off { opacity: .4; cursor: not-allowed; }
.pagination__btn svg { width: 20px; height: 20px; }
.pagination__pages { display: flex; align-items: center; gap: 4px; }
.pagination__page { min-width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.pagination__page:hover { border-color: var(--ink); }
.pagination__page.is-active { background: var(--ink); border-color: var(--ink); color: #fff; cursor: default; }
.pagination__ellipsis { color: var(--muted); padding: 0 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .catalog { grid-template-columns: 240px minmax(0, 1fr); gap: 20px; }
  .grid-products { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .catalog { grid-template-columns: 1fr; }
  .filters { position: fixed; inset: 0 0 0 auto; width: 320px; max-width: 85vw; max-height: 100vh; border-radius: 0; border-left: 1px solid var(--line); z-index: 100; transform: translateX(100%); transition: transform .25s ease; }
  .filters[data-open] { transform: translateX(0); }
  .filters__head { position: sticky; top: 0; background: #fbfbfc; z-index: 1; margin-bottom: 16px; padding-bottom: 12px; }
  .filter-group__toggle { display: grid; }
  .filter-group__body { display: none; }
  .filter-group__body[data-open] { display: flex; }
  .grid-products { grid-template-columns: repeat(2, 1fr); }
  .catalog__bar { flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .page-head h1 { font-size: 24px; }
  .grid-products { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-products[data-view="list"] .prod { grid-template-columns: 100%; }
  .grid-products[data-view="list"] .prod__media { width: 100%; min-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
  .prod__price { font-size: 16px; }
  .catalog__bar { padding: 10px 12px; }
  .catalog__tools { width: 100%; justify-content: space-between; }
  .filter-toggle { flex: 1; justify-content: center; }
}
@media (max-width: 480px) {
  .grid-products { grid-template-columns: 1fr; }
  .grid-products[data-view="list"] .prod { grid-template-columns: 1fr; }
}

/* ---------- focus visible ---------- */
*:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn:focus-visible, .filter-option:focus-visible, .pagination__page:focus-visible { outline-offset: 2px; }