/*
 * Ürün listesi — filtre paneli + toolbar + grid görünümü
 * Ambalaj katalogu: sakin, net, boğmayan
 */

.shop-listing {
  padding: var(--space-8) 0 var(--space-16);
  background: var(--color-bg);
}

.shop-listing__layout {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}

/* ——— Filtre paneli ——— */
.shop-filter {
  position: sticky;
  top: calc(var(--header-main-h, 84px) + 16px);
  max-height: calc(100vh - var(--header-main-h, 84px) - 32px);
  z-index: 20;
}

.shop-filter__panel {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.shop-filter__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--color-bg) 65%, #fff) 100%);
}

.shop-filter__title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--color-dark);
}

.shop-filter__clear {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.shop-filter__clear:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.shop-filter__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--color-primary) 35%, #cbd5e1) transparent;
}

.shop-filter__section {
  padding: 14px 18px 16px;
}

.shop-filter__section + .shop-filter__section {
  border-top: 1px solid color-mix(in srgb, var(--color-border) 80%, transparent);
}

.shop-filter__label {
  display: block;
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.shop-filter__price {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
}

.shop-filter__field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.shop-filter__field input[type="number"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-dark);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.shop-filter__field input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.shop-filter__search {
  position: relative;
  display: flex;
  align-items: center;
}

.shop-filter__search > i {
  position: absolute;
  left: 12px;
  color: var(--color-text-muted);
  font-size: 13px;
  pointer-events: none;
}

.shop-filter__search input[type="search"] {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-dark);
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.shop-filter__search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.shop-filter__search input[type="search"]:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.shop-filter__search-clear {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.shop-filter__search-clear:hover {
  color: var(--color-dark);
  background: color-mix(in srgb, var(--color-border) 55%, #fff);
}

.shop-filter__price-sep {
  padding-bottom: 10px;
  color: var(--color-text-muted);
  font-weight: 700;
  user-select: none;
}

.shop-filter__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
}

.shop-filter__option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.shop-filter__option:hover {
  background: var(--color-bg);
}

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

.shop-filter__check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.shop-filter__check::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px) scale(0);
  transition: transform var(--transition-fast);
}

.shop-filter__option input[type="radio"] + .shop-filter__check {
  border-radius: 50%;
}

.shop-filter__option input[type="radio"] + .shop-filter__check::after {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
}

.shop-filter__option input:checked + .shop-filter__check {
  border-color: var(--color-primary);
  background: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.shop-filter__option input:checked + .shop-filter__check::after {
  transform: rotate(-45deg) translateY(-1px) scale(1);
}

.shop-filter__option input[type="radio"]:checked + .shop-filter__check::after {
  transform: scale(1);
}

.shop-filter__option-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-dark);
  line-height: 1.3;
}

.shop-filter__option input:checked ~ .shop-filter__option-text {
  color: var(--color-primary-dark);
}

.shop-filter__actions {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-border);
  background: color-mix(in srgb, #fff 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -8px 20px -12px rgba(15, 23, 42, 0.18);
}

.shop-filter__actions .btn-magaza {
  width: 100%;
  height: 44px;
}

/* ——— Ana içerik ——— */
.shop-listing__main {
  min-width: 0;
}

.shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: var(--space-5);
  padding: 12px 16px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.shop-toolbar__meta {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.shop-toolbar__meta strong {
  color: var(--color-dark);
  font-weight: 800;
}

.shop-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.shop-toolbar__sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-toolbar__sort select {
  height: 38px;
  min-width: 160px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748B' d='M6 8L0 0h12z'/%3E%3C/svg%3E") no-repeat right 12px center / 10px;
  color: var(--color-dark);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.shop-toolbar__sort select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.shop-view {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  gap: 2px;
}

.shop-view__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 32px;
  border: 0;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.shop-view__btn:hover {
  color: var(--color-dark);
  background: #fff;
}

.shop-view__btn.is-active {
  background: #fff;
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.shop-view__btn svg {
  display: block;
}

.shop-view__btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ——— Ürün grid ——— */
.shop-product-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(var(--shop-cols, 3), minmax(0, 1fr));
  transition: opacity var(--transition-fast);
}

.shop-product-grid[data-cols="2"] {
  --shop-cols: 2;
}

.shop-product-grid[data-cols="3"] {
  --shop-cols: 3;
}

.shop-product-grid[data-cols="4"] {
  --shop-cols: 4;
}

.shop-product-grid > * {
  min-width: 0;
}

.shop-listing__pager {
  margin-top: var(--space-8);
}

/* ——— Responsive ——— */
@media (max-width: 1199.98px) {
  .shop-listing__layout {
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    gap: var(--space-6);
  }

  .shop-product-grid[data-cols="4"] {
    --shop-cols: 3;
  }
}

@media (max-width: 991.98px) {
  .shop-listing__layout {
    grid-template-columns: 1fr;
  }

  .shop-filter {
    position: relative;
    top: auto;
    max-height: none;
    z-index: 1;
  }

  .shop-filter__panel {
    max-height: min(70vh, 560px);
  }

  .shop-filter__actions {
    /* mobil: panel içinde alta yapışık kalır */
    position: sticky;
    bottom: 0;
  }

  .shop-view__btn[data-cols="4"] {
    display: none;
  }

  .shop-product-grid,
  .shop-product-grid[data-cols="3"],
  .shop-product-grid[data-cols="4"] {
    --shop-cols: 2;
  }

  .shop-product-grid[data-cols="2"] {
    --shop-cols: 2;
  }
}

@media (max-width: 575.98px) {
  .shop-listing {
    padding-top: var(--space-5);
  }

  .shop-toolbar {
    padding: 12px;
  }

  .shop-toolbar__right {
    width: 100%;
    justify-content: space-between;
  }

  .shop-toolbar__sort {
    flex: 1;
  }

  .shop-toolbar__sort select {
    width: 100%;
    min-width: 0;
  }

  .shop-product-grid,
  .shop-product-grid[data-cols="2"],
  .shop-product-grid[data-cols="3"],
  .shop-product-grid[data-cols="4"] {
    --shop-cols: 2;
    gap: var(--space-3);
  }

  .shop-filter__panel {
    max-height: min(65vh, 480px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .shop-filter__option,
  .shop-filter__check,
  .shop-view__btn,
  .shop-product-grid {
    transition: none;
  }
}
