/* ============================================================
   Product results — page body (prefix pr-)
   Used by resources/views/frontend/product_results/product_results.blade.php
   on the search, category and brand pages.
   Built from the approved design (korners-search-results-standalone.html).
   Standard: no clamp(), fixed px with media queries, tokens on the
   page wrapper. The shared card's own styles stay in product-card.css.

   Screen widths (from the design):
     ≥1400  sidebar + 4 per row
     ≤1399  sidebar + 3 per row
     ≤1060  filters become a slide-in panel
     ≤700   2 per row, smaller card text
     ≤390   tighter spacing
   ============================================================ */

/* ---------- page + tokens ---------- */

.pr-page {
  --pr-ink: #00002e;
  --pr-text: #23252a;
  --pr-subtle: #6b7280;
  --pr-border: #e7e7e7;
  --pr-orange: #ff4500;
  --pr-bg: #fff;

  width: 100%;
  padding: 24px 44px 65px;
  background: var(--pr-bg);
  color: var(--pr-text);
  font-family: Poppins, 'Segoe UI', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.pr-page *,
.pr-page *::before,
.pr-page *::after { box-sizing: border-box; }
.pr-page button,
.pr-page input,
.pr-page select { font: inherit; }
.pr-page button { cursor: pointer; }

.pr-page > form > h1 {
  padding-bottom: 23px;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--pr-border);
}

/* ---------- layout ---------- */

.pr-body {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: start;
  gap: 38px;
}

/* ---------- filters ---------- */

.pr-sidebar { min-width: 0; }
.pr-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 17px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--pr-border);
}
.pr-sidebar-header strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--pr-ink);
}
.pr-sidebar-header strong svg { width: 18px; height: 18px; }
.pr-clear {
  padding: 4px 0;
  color: var(--pr-orange);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.pr-clear:hover { color: var(--pr-orange); text-decoration: underline; }

.pr-filter-group {
  border-bottom: 1px solid var(--pr-border);
  padding: 0 0 18px;
  margin-bottom: 19px;
}
.pr-filter-group summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--pr-ink);
}
.pr-filter-group summary::-webkit-details-marker { display: none; }
.pr-filter-group summary svg { width: 16px; height: 16px; transition: transform .2s; }
.pr-filter-group:not([open]) summary svg { transform: rotate(-90deg); }
.pr-filter-body { padding: 17px 0 0; }

/* category options (links styled as the design's radio options) */
.pr-option {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 15px;
  color: #454750;
  font-size: 13px;
  text-decoration: none;
}
.pr-option:last-child { margin-bottom: 0; }
a.pr-option:hover { color: var(--pr-ink); text-decoration: none; }
.pr-option--child { padding-inline-start: 26px; }
/* category tree levels (search engine categories) */
.pr-option--d1 { padding-inline-start: 0; }
.pr-option--d2 { padding-inline-start: 18px; }
.pr-option--d3 { padding-inline-start: 36px; }
.pr-dot {
  width: 17px;
  height: 17px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid #b5b9bf;
  background: #fff;
}
.pr-option.is-active { color: var(--pr-ink); font-weight: 600; }
.pr-option.is-active .pr-dot {
  background: var(--pr-orange);
  border-color: var(--pr-orange);
  box-shadow: inset 0 0 0 4px #fff;
}

/* checkbox options (shipping, deals, coupons) */
.pr-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 15px;
  color: #454750;
  font-size: 13px;
  cursor: pointer;
  position: relative;
}
.pr-check:last-child { margin-bottom: 0; }
.pr-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pr-box {
  width: 17px;
  height: 17px;
  flex: none;
  border-radius: 4px;
  border: 1.5px solid #b5b9bf;
  background: #fff;
  position: relative;
}
.pr-check input:checked + .pr-box { background: var(--pr-orange); border-color: var(--pr-orange); }
.pr-check input:checked + .pr-box::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.pr-check input:checked ~ span:last-child { color: var(--pr-ink); font-weight: 600; }
.pr-check input:focus-visible + .pr-box { outline: 2px solid #ffd7c6; outline-offset: 2px; }

/* price */
.pr-price-track {
  height: 4px;
  border-radius: 3px;
  background: var(--pr-orange);
  margin: 5px 0 23px;
  position: relative;
}
.pr-price-track::before,
.pr-price-track::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  background: #fff;
  border: 3px solid var(--pr-orange);
  border-radius: 50%;
  transform: translateY(-50%);
}
.pr-price-track::before { left: 0; }
.pr-price-track::after { right: 0; }
.pr-price-fields {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 9px;
  align-items: center;
}
.pr-price-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-size: 11px;
  color: var(--pr-subtle);
}
.pr-price-fields input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--pr-border);
  border-radius: 4px;
  background: #fff;
  padding: 9px 10px;
  font-size: 13px;
  color: #242833;
}
.pr-price-fields input:focus,
.pr-select:focus { outline: 2px solid #ffd7c6; border-color: var(--pr-orange); }
.pr-price-dash { padding-top: 17px; color: #a1a1a1; }

/* colours */
.pr-colors { display: flex; flex-wrap: wrap; gap: 12px; }
.pr-colors label { cursor: pointer; position: relative; margin: 0; }
.pr-colors input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pr-color {
  width: 27px;
  height: 27px;
  display: inline-block;
  border-radius: 50%;
  border: 1px solid #ddd;
}
.pr-color--all { background: conic-gradient(#f4511e 0deg 90deg, #2563eb 90deg 180deg, #ffc107 180deg 270deg, #16a34a 270deg); }
.pr-colors input:checked + .pr-color { outline: 2px solid var(--pr-orange); outline-offset: 3px; }

.pr-mobile-filter-btn,
.pr-mobile-close,
.pr-overlay { display: none; }

/* ---------- toolbar ---------- */

.pr-content { min-width: 0; }
.pr-toolbar {
  min-height: 47px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
}
.pr-total { display: flex; align-items: center; gap: 10px; color: #717680; font-size: 13px; }
.pr-total strong { color: #111827; font-weight: 600; }
.pr-sort {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  white-space: nowrap;
  font-size: 13px;
  color: #656a73;
}
.pr-select-wrap { position: relative; }
.pr-select {
  appearance: none;
  -webkit-appearance: none;
  width: 198px;
  height: 39px;
  padding: 0 38px 0 13px;
  background: #fff;
  border: 1px solid var(--pr-border);
  border-radius: 5px;
  color: #202530;
  font-size: 13px;
  cursor: pointer;
}
.pr-select-wrap svg {
  width: 15px;
  height: 15px;
  position: absolute;
  right: 12px;
  top: 12px;
  pointer-events: none;
}

/* any-word fallback notice */
.pr-note {
  margin: 0 0 16px;
  padding: 10px 14px;
  background: #fff6f1;
  border: 1px solid #ffd7c6;
  border-radius: 5px;
  font-size: 13px;
  color: var(--pr-ink);
}

/* ---------- grid ---------- */

.pr-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 20px;
  align-items: start;
}
.pr-grid__item { min-width: 0; }
/* card appearance stays owned by product-card.css */
.pr-grid .pc-card { height: 100%; }
/* no photo background on the results page (product-card.css is not changed) */
.pr-grid .pc-card__media { background: transparent; }

/* ---------- empty ---------- */

.pr-empty {
  padding: 80px 10px;
  text-align: center;
  background: #fafafa;
  border: 1px solid var(--pr-border);
}
.pr-empty h2 { margin: 0 0 9px; font-size: 18px; font-weight: 600; color: var(--pr-ink); }
.pr-empty p { margin: 0 0 20px; font-size: 13px; color: var(--pr-subtle); }
.pr-empty__btn {
  display: inline-block;
  background: var(--pr-ink);
  color: #fff;
  padding: 11px 20px;
  border-radius: 4px;
  text-decoration: none;
}
.pr-empty__btn:hover { color: #fff; text-decoration: none; opacity: .9; }

/* ---------- bottom + page numbers ---------- */

.pr-bottom {
  border-top: 1px solid var(--pr-border);
  margin-top: 35px;
  padding-top: 22px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  font-size: 12px;
  color: var(--pr-subtle);
}
.pr-pagination { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.pr-pagination a,
.pr-pagination span {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--pr-border);
  border-radius: 4px;
  color: #333;
  text-decoration: none;
}
.pr-pagination a:hover { border-color: var(--pr-ink); color: var(--pr-ink); text-decoration: none; }
.pr-pagination [aria-current] { background: var(--pr-ink); border-color: var(--pr-ink); color: #fff; }
.pr-pagination .is-disabled { color: #c4c4c4; cursor: not-allowed; }
.pr-pagination .pr-gap { border-color: transparent; background: transparent; min-width: 20px; padding: 0; }

/* ---------- ≤1399: 3 per row ---------- */

@media (max-width: 1399px) {
  .pr-page { padding-inline: 32px; }
  .pr-body { gap: 24px; }
  .pr-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- ≤1060: filters become a slide-in panel ---------- */

@media (max-width: 1060px) {
  .pr-page { padding-inline: 24px; }
  .pr-body { display: block; }
  .pr-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1045;
    width: 340px;
    max-width: 88vw;
    padding: 22px 24px 38px;
    background: #fff;
    overflow: auto;
    transform: translateX(-105%);
    transition: transform .23s ease;
    box-shadow: 8px 0 40px rgba(0, 0, 0, .12);
  }
  .pr-sidebar.is-open { transform: translateX(0); }
  .pr-clear { margin-inline-start: auto; margin-inline-end: 10px; }
  .pr-mobile-close {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border: 0;
    background: #f4f4f4;
    border-radius: 4px;
  }
  .pr-mobile-close svg { width: 19px; height: 19px; }
  .pr-overlay.is-open {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 1044;
  }
  .pr-mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 39px;
    padding: 0 15px;
    border: 1px solid var(--pr-border);
    background: #fff;
    border-radius: 5px;
    color: var(--pr-ink);
    font-size: 13px;
    font-weight: 600;
  }
  .pr-mobile-filter-btn svg { width: 17px; height: 17px; }
  .pr-toolbar { flex-wrap: wrap; }
  .pr-toolbar-right { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }
}

/* ---------- ≤700: phones, 2 per row ---------- */

@media (max-width: 700px) {
  .pr-page { padding: 17px 15px 50px; }
  .pr-page > form > h1 { padding-bottom: 18px; margin-bottom: 15px; }
  .pr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 23px 12px; }
  .pr-sort > span:first-child { display: none; }
  /* Filters button + sort: two equal halves, full width */
  .pr-toolbar-right {
    width: 100%;
    margin-inline-start: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .pr-mobile-filter-btn { width: 100%; }
  .pr-sort,
  .pr-select-wrap { display: block; width: 100%; }
  .pr-select { width: 100%; }
  .pr-bottom { margin-top: 26px; flex-wrap: wrap; }
  .pr-grid .pc-card__title { font-size: 13px; }
  .pr-grid .pc-card__now { font-size: 16px; }
  .pr-grid .pc-card__was { font-size: 11px; }
  .pr-grid .pc-card__btn { font-size: 12px; }
}

/* ---------- ≤390: small phones ---------- */

@media (max-width: 390px) {
  .pr-page { padding-inline: 12px; }
  .pr-mobile-filter-btn { padding-inline: 11px; }
  .pr-toolbar-right { gap: 8px; }
  .pr-grid { gap: 20px 10px; }
  .pr-grid .pc-card__btn { padding-inline: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .pr-sidebar,
  .pr-filter-group summary svg { transition: none; }
}
