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

[x-cloak] {
  display: none !important;
}

.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: stretch;
}

/* ——— Filtre paneli ——— */
.shop-filter-slot {
  min-width: 0;
  width: 100%;
  align-self: stretch;
}

.shop-filter {
  --shop-filter-offset: calc(var(--header-main-h, 84px) + var(--header-nav-h, 68px) + 12px);
  box-sizing: border-box;
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  z-index: 20;
}

.shop-filter__panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  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__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.shop-filter__title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--color-dark);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.shop-filter__title i {
  color: var(--color-primary);
  font-size: 14px;
}

.shop-filter__chevron {
  font-size: 12px;
  color: var(--color-text-muted);
  transition: transform .2s ease;
}

.shop-filter__chevron.is-open {
  transform: rotate(180deg);
}

.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__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.shop-filter__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 0 16px;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: var(--color-primary) #e8eef5;
}

.shop-filter__scroll::-webkit-scrollbar {
  width: 10px;
}

.shop-filter__scroll::-webkit-scrollbar-track {
  background: #eef2f7;
  border-left: 1px solid var(--color-border);
}

.shop-filter__scroll::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 8px;
  border: 2px solid #eef2f7;
}

.shop-filter__fade-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 10px;
  height: 32px;
  pointer-events: none;
  background: linear-gradient(to bottom, #fff 0%, transparent 100%);
  z-index: 2;
}

.shop-filter__more {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
  max-width: none;
  height: auto;
  padding: 36px 8px 10px;
  border: 0 !important;
  border-radius: 0;
  background: linear-gradient(to top, #fff 38%, rgba(255, 255, 255, 0.92) 58%, transparent 100%) !important;
  color: var(--color-primary) !important;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1;
}

.shop-filter__more i {
  font-size: 13px;
  animation: shop-filter-bounce 1.15s ease-in-out infinite;
}

@keyframes shop-filter-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

.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__hint {
  margin: -6px 0 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text-muted);
}

.shop-filter__sub {
  margin-top: 12px;
}

.shop-filter__sub + .shop-filter__sub {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--color-border) 85%, transparent);
}

.shop-filter__sub-title {
  display: block;
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--color-dark);
}

.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-bar {
  flex-shrink: 0;
  padding: 4px 18px 16px;
  background: #fff;
}

.shop-filter__search-bar .shop-filter__label {
  margin-bottom: 8px;
}

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

.shop-filter__search-submit {
  position: absolute;
  left: 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;
  padding: 0;
  z-index: 1;
}

.shop-filter__search-submit:hover,
.shop-filter__search-submit:focus-visible {
  color: var(--color-primary);
  outline: none;
}

.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__search-clear[hidden],
.shop-listing__more[hidden],
.shop-listing__spinner[hidden],
.shop-listing__status[hidden],
.shop-product-grid[hidden],
.shop-toolbar__pages[hidden] {
  display: none !important;
}

.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;
  margin: 0 -6px;
  padding: 0 6px;
}

.shop-filter__option {
  position: relative;
  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;
  margin-top: auto;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-border);
  background: #fff;
  box-shadow: 0 -10px 24px -12px rgba(15, 23, 42, 0.22);
}

.shop-filter__actions .btn-magaza {
  width: 100% !important;
  height: 46px;
  font-size: 14px;
}

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

.shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  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__heading {
  flex: 1 1 220px;
  min-width: 0;
}

.shop-listing__title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--color-dark);
  letter-spacing: -0.02em;
}

.shop-listing__intro {
  margin: 0 0 8px;
  max-width: 52rem;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.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: 148px;
  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);
}

.shop-listing__pager--top {
  margin-top: 0;
  margin-bottom: var(--space-5);
}

.shop-toolbar__pages {
  font-weight: 600;
  color: var(--color-text-muted);
}

.shop-product-grid.is-loading {
  opacity: 0.45;
  pointer-events: none;
}

.shop-filter__panel.is-ajax-busy .btn-magaza {
  pointer-events: none;
  opacity: 0.7;
}

.shop-listing__more {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  margin-top: var(--space-8);
  padding-bottom: var(--space-6);
}

.shop-listing__sentinel {
  width: 1px;
  height: 1px;
}

.shop-listing__spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: shop-listing-spin 0.7s linear infinite;
}

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

@keyframes shop-listing-spin {
  to { transform: rotate(360deg); }
}

/* ——— 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 {
    padding-top: var(--space-5);
  }

  .shop-listing__layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .shop-filter-slot {
    order: 1;
    height: auto;
    max-height: none;
    width: 100%;
    position: relative;
    top: auto;
    align-self: stretch;
  }

  .shop-listing__main {
    order: 2;
    width: 100%;
  }

  .shop-filter {
    --shop-filter-offset: 0;
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
    max-height: none;
    z-index: 20;
    overflow: visible;
  }

  .shop-filter__panel {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  /* Accordion: arama her zaman açık; diğer filtreler kapalı */
  .shop-filter__head {
    padding: 12px 14px;
  }

  .shop-filter__search-bar {
    padding: 0 14px 12px;
  }

  .shop-filter__search-bar .shop-filter__label {
    display: none;
  }

  .shop-filter__panel:not(.is-open) .shop-filter__head {
    border-bottom: 0;
  }

  .shop-filter__panel:not(.is-open) .shop-filter__search-bar {
    border-bottom: 0;
  }

  .shop-filter__panel.is-open .shop-filter__search-bar {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 12px;
  }

  .shop-filter__panel:not(.is-open) .shop-filter__body {
    display: none !important;
  }

  .shop-filter__panel.is-open .shop-filter__body {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    border-top: 1px solid var(--color-border);
  }

  .shop-filter__toggle {
    pointer-events: auto;
    cursor: pointer;
    width: 100%;
  }

  .shop-filter__chevron {
    display: inline-block;
    margin-left: auto;
    flex-shrink: 0;
  }

  .shop-filter__price {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .shop-filter__price-sep {
    display: none;
  }

  .shop-filter__scroll {
    flex: 0 1 auto;
    max-height: min(42svh, 320px);
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: var(--color-primary) #e8eef5;
  }

  .shop-filter__list {
    gap: 4px;
  }

  .shop-filter__option {
    position: relative;
    min-height: 40px;
  }

  /* Mobilde “aşağı kaydırın” ürünleri gizliyor — tamamen kapat */
  .shop-filter__more,
  .shop-filter__fade-top {
    display: none !important;
  }

  .shop-filter__actions {
    flex-shrink: 0;
    padding: 12px 16px 16px;
  }

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

  .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 (min-width: 992px) {
  .shop-filter-slot {
    --shop-filter-offset: calc(var(--header-main-h, 106px) + var(--header-nav-h, 83px) - 145px);
    align-self: start;
    position: sticky;
    top: var(--shop-filter-offset);
    height: calc(100vh - var(--shop-filter-offset) - 16px);
    height: calc(100dvh - var(--shop-filter-offset) - 16px);
    max-height: calc(100vh - var(--shop-filter-offset) - 16px);
    max-height: calc(100dvh - var(--shop-filter-offset) - 16px);
  }

  .shop-filter,
  .shop-filter__panel {
    height: 100%;
    max-height: 100%;
    min-height: 0;
  }

  .shop-filter__panel {
    flex: 1 1 0;
  }

  .shop-filter__toggle {
    pointer-events: none;
    cursor: default;
  }

  .shop-filter__chevron {
    display: none;
  }

  .shop-filter__search-bar {
    padding: 4px 18px 14px;
    border-bottom: 1px solid var(--color-border);
  }

  .shop-filter__panel .shop-filter__body,
  .shop-filter__panel:not(.is-open) .shop-filter__body {
    display: flex !important;
    flex: 1 1 0;
    min-height: 0;
  }

  .shop-filter__scroll {
    overflow-y: auto;
    padding-bottom: 8px;
  }

  .shop-filter__more,
  .shop-filter__fade-top {
    display: none !important;
  }
}

@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);
  }
}

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

  .shop-filter__more i,
  .shop-listing__spinner {
    animation: none;
  }
}
