/* ==========================================================================
   DeskWerk, productpagina
   Tokens komen uit style.css.
   ========================================================================== */

/* Indeling: filters links, producten rechts
   -------------------------------------------------------------------------- */
/* minmax(0, 1fr): de kolom groeit nooit mee met inhoud die niet past */
.shop {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: start;
  gap: 48px;
  padding-top: 40px;
  padding-bottom: 96px;
}

/* Filters
   -------------------------------------------------------------------------- */
.filters {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  padding-right: 4px;
}

.filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin-bottom: 8px;
}

.filters__title { font-size: 20px; }

/* Alleen in het filterpaneel op tablet en telefoon */
.filters-open,
.filters__close,
.filters__foot { display: none; }

.btn--xs {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.filter {
  margin: 0;
  padding: 20px 0;
  border: 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}

/* Zwevende legend: zo staat de titel boven de opties en niet op de lijn */
.filter__title {
  float: left;
  width: 100%;
  margin-bottom: 12px;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
}

.filter__options {
  clear: both;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* position: relative houdt het verborgen vakje bij zijn label. Anders schuift de
   browser bij focus het hele paneel of de pagina om het in beeld te brengen. */
.filter__option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 15px;
  cursor: pointer;
}

.filter__box {
  display: grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--gray);
  border-radius: 4px;
  background: var(--card);
  transition: background-color .15s, border-color .15s;
}

.filter__box svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.filter__option:hover .filter__box { border-color: var(--accent); }

.filter__option:has(input:checked) .filter__box {
  border-color: var(--accent);
  background: var(--accent);
}

.filter__option:has(input:checked) .filter__box svg { opacity: 1; }

.filter__name { flex: 1; }

.filter__count {
  color: var(--gray);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Kleuren als bolletjes met naam */
.filter--swatches .filter__options {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

.filter__swatch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s;
}

.filter__swatch:hover { border-color: var(--gray); }

.filter__dot {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(31, 35, 38, .15);
  border-radius: 50%;
}

.filter__swatch:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.filter .is-empty {
  opacity: .4;
  cursor: default;
}

.filter__option:has(input:focus-visible),
.filter__swatch:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Resultaten
   -------------------------------------------------------------------------- */
/* Aantal links, sorteren rechts, daaronder de actieve filters en de producten */
.results {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  outline: none;
}

.results > :not(.results__bar):not(.results__count) { grid-column: 1 / -1; }

.results__bar {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin-bottom: 16px;
}

.results__count {
  grid-column: 1;
  grid-row: 1;
  margin-bottom: 16px;
  font-weight: 700;
}

.results__sort {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray);
  font-size: 14px;
}

.results__sort select {
  height: 40px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%235C6166' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}

.results__sort select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Actieve filters */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.chips[hidden] { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  transition: background-color .15s, color .15s;
}

.chip svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.chip:hover {
  background: var(--accent);
  color: #fff;
}

/* Productkaarten */
/* Zoveel kolommen als er passen. Een kaart is minstens 280px breed, dan past de
   knop "Toevoegen aan werkplek" op één regel. */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Geen link, dus geen hover-lift: de knop is de actie */
.product {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.product__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface);
}

.product__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* "Uw foto": plek voor een productfoto */
.product__placeholder {
  position: absolute;
  inset: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed #C9C3B8;
  border-radius: 6px;
  color: var(--gray);
  font-size: 15px;
  font-weight: 700;
}

.product__placeholder svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.product__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.product__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px 20px 20px;
}

.product__group {
  margin-bottom: 4px;
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.product__name { margin-bottom: 4px; font-size: 19px; }

.product__spec {
  color: var(--gray);
  font-size: 14px;
  line-height: 1.5;
}

.product__colors {
  display: flex;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.product__colors li {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(31, 35, 38, .15);
  border-radius: 50%;
}

/* Prijs en voorraad onder elkaar, bij elk product gelijk */
.product__foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  padding-top: 16px;
}

.product__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
}

.product__price strong { font-size: 22px; font-weight: 800; }

.product__from,
.product__vat { color: var(--gray); font-size: 13px; }

.product__stock {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray);
  font-size: 13px;
  white-space: nowrap;
}

.product__stock::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #B9B3A8;
}

.product__stock.is-in { color: var(--accent); font-weight: 500; }
.product__stock.is-in::before { background: var(--accent); }

.product__add {
  width: 100%;
  margin-top: 16px;
}

.product__add svg { width: 16px; height: 16px; }
.product__add:hover svg { transform: none; }

/* Niets gevonden */
.results__empty {
  padding: 64px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.results__empty-title {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 800;
}

.results__empty p:not(.results__empty-title) {
  margin-bottom: 24px;
  color: var(--gray);
}

/* Afsluiter
   -------------------------------------------------------------------------- */
.shop-cta {
  padding: 64px 0;
  background: var(--surface);
}

.shop-cta__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.shop-cta__title { margin-bottom: 8px; font-size: 28px; }

.shop-cta__inner p { color: var(--gray); }

.shop-cta__actions {
  display: flex;
  flex: none;
  gap: 12px;
}

/* ==========================================================================
   Tablet en telefoon
   ========================================================================== */

@media (max-width: 960px) {
  .shop {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-top: 24px;
    padding-bottom: 64px;
  }

  /* Filters als paneel over het hele scherm, geopend met de knop Filters */
  .filters {
    position: fixed;
    z-index: 80;
    inset: 0;
    display: none;
    flex-direction: column;
    max-height: none;
    padding: 0;
    overflow: hidden;
    background: var(--bg);
  }

  .filters.is-open { display: flex; }

  .filters__head {
    flex: none;
    gap: 12px;
    min-height: 64px;
    margin: 0;
    padding: 0 10px 0 20px;
    border-bottom: 1px solid var(--border);
  }

  .filters__title { margin-right: auto; }

  .filters__close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
  }

  .filters__close svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }

  .filters__form {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 20px 8px;
  }

  .filters__form .filter:first-child { border-top: 0; }

  .filters__foot {
    display: block;
    flex: none;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--card);
  }

  .filters__show { width: 100%; }

  /* Grotere vlakken om op te tikken */
  .filter__option { padding: 8px 0; font-size: 16px; }
  .filter__swatch { padding: 7px 14px 7px 7px; font-size: 15px; }

  /* Achter het paneel scrolt de pagina niet mee */
  html.has-drawer { overflow: hidden; }

  /* Balk met filterknop en sorteren, blijft onder de header plakken; aantal eronder */
  .results { display: block; }

  .results__bar {
    position: sticky;
    z-index: 20;
    top: var(--header-h);
    justify-content: space-between;
    margin: 0 -24px;
    padding: 10px 24px;
    background: var(--bg);
    transition: box-shadow .15s;
  }

  .results__bar.is-stuck { box-shadow: 0 1px 0 var(--border), 0 8px 16px rgba(31, 35, 38, .06); }

  .results__count { margin: 6px 0 16px; }

  .filters-open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px 0 14px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
  }

  .filters-open svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }

  .filters-open circle { fill: var(--card); }

  .filters-open__count {
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
  }

  /* De sorteerkeuze mag krimpen als er naast de filterknop weinig ruimte is.
     16px, anders zoomt iOS in bij het openen. */
  .results__sort { flex: 0 1 auto; min-width: 0; }
  .results__sort-label { white-space: nowrap; }

  .results__sort select {
    width: 100%;
    min-width: 0;
    height: 44px;
    font-size: 16px;
    text-overflow: ellipsis;
  }

  .filters-open { flex: none; }

  .shop-cta__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
}

@media (max-width: 640px) {
  .results__bar {
    margin: 0 -20px;
    padding: 10px 20px;
  }

  .results__sort-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  /* Productkaart als rij: foto links, tekst rechts, prijs en knop over de hele breedte */
  .product-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .product {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr;
    column-gap: 16px;
    align-items: start;
    padding: 16px;
  }

  .product__body { display: contents; }

  .product__media {
    grid-column: 1;
    grid-row: 1 / span 4;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
  }

  .product__group,
  .product__name,
  .product__spec,
  .product__colors { grid-column: 2; }

  .product__group { font-size: 11px; }
  .product__name { font-size: 17px; }
  .product__spec { font-size: 13px; }
  .product__colors { margin-top: 8px; }

  .product__foot {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
    margin-top: 0;
    padding-top: 16px;
  }

  .product__price strong { font-size: 20px; }

  .product__add {
    grid-column: 1 / -1;
    margin-top: 12px;
  }

  .product__badge {
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    font-size: 11px;
  }

  .product__placeholder {
    inset: 8px;
    gap: 4px;
    font-size: 13px;
  }

  .product__placeholder svg { width: 24px; height: 24px; }

  /* Lange samenstellingen (Laptopstandaarden) mogen afbreken in de smalle tekstkolom */
  .product__group,
  .product__name,
  .product__spec {
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .results__empty { padding: 48px 20px; }

  .shop-cta { padding: 48px 0; }
  .shop-cta__title { font-size: 24px; }

  .shop-cta__actions {
    flex-direction: column;
    align-self: stretch;
  }

  .shop-cta__actions .btn { width: 100%; }
}

/* Kleine telefoon: smallere foto, iets kleinere naam */
@media (max-width: 360px) {
  .product { grid-template-columns: 88px minmax(0, 1fr); column-gap: 12px; }
  .product__name { font-size: 16px; }
}

/* Aanraakschermen: geen hover-toestand die na een tik blijft hangen */
@media (hover: none) {
  .chip:hover {
    background: var(--card);
    color: var(--accent);
  }

  .filter__option:hover .filter__box { border-color: var(--gray); }
  .filter__option:has(input:checked):hover .filter__box { border-color: var(--accent); }
  .filter__swatch:hover { border-color: var(--border); }
  .filter__swatch:has(input:checked):hover { border-color: var(--accent); }
}
