/* ============================================================
   COLLECTION DETAIL PAGE — theme-aligned styles
   ============================================================ */

/* ---------- 01. PAGE WRAPPER ---------- */
.listing-page { padding: 30px 0 70px; }

/* ---------- 02. BREADCRUMB ---------- */
.listing-breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; font-size: .85rem;
  color: var(--muted); margin-bottom: 16px;
}
.listing-breadcrumb a {
  color: var(--muted); text-decoration: none; transition: color .2s;
}
.listing-breadcrumb a:hover { color: var(--primary); }
.listing-breadcrumb .separator { color: var(--border); font-weight: 700; }
@media (max-width: 600px) {
  .listing-breadcrumb { font-size: .78rem; gap: 6px; }
}

/* ---------- 03. COLLECTION HERO ---------- */
.listing-header {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 36px 44px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.listing-title {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600; line-height: 1.15;
  letter-spacing: -.01em; margin-bottom: 8px; color: #fff;
}
.listing-subtitle {
  font-size: .95rem; opacity: .92;
  max-width: 560px; margin-bottom: 12px;
}
.listing-header .listing-breadcrumb { color: rgba(255,255,255,.85); margin-bottom: 0; }
.listing-header .listing-breadcrumb a { color: rgba(255,255,255,.85); }
.listing-header .listing-breadcrumb a:hover { color: var(--secondary-light); }
.listing-header .listing-breadcrumb .separator { color: rgba(255,255,255,.5); }
@media (max-width: 600px) {
  .listing-header { padding: 26px 20px; }
  .listing-subtitle { font-size: .88rem; }
}

/* ---------- 04. LAYOUT ---------- */
.listing-layout {
  display: grid; grid-template-columns: 260px 1fr;
  gap: 24px; align-items: start;
}
@media (max-width: 992px) { .listing-layout { grid-template-columns: 1fr; } }

/* ---------- 05. FILTER SIDEBAR ---------- */
.listing-sidebar {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky; top: calc(var(--header-h) + 14px);
  height: fit-content;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.sidebar-header h3 {
  font-family: var(--font-head); font-size: 1.2rem;
  font-weight: 600; color: var(--primary);
}
.clear-all-filters {
  background: none; border: none;
  color: var(--primary); font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: color .2s;
}
.clear-all-filters:hover { color: var(--secondary); text-decoration: underline; }

.sidebar-body { padding: 0; }

.filter-section {
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.filter-section:last-child { border-bottom: 0; }
.filter-section-title {
  font-size: .9rem; font-weight: 500;
  color: var(--text); margin-bottom: 12px;
  letter-spacing: .02em;
}

.filter-categories {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 250px; overflow-y: auto;
}
.category-link {
  display: block; width: 100%; text-align: left;
  background: none; border: none;
  color: var(--muted); font-size: .86rem;
  padding: 6px 0; cursor: pointer;
  transition: all .15s; border-radius: 6px;
}
.category-link:hover { color: var(--primary); padding-left: 6px; }
.category-link.active { color: var(--primary); font-weight: 500; padding-left: 6px; }

.filter-options { display: flex; flex-direction: column; gap: 8px; }
.filter-checkbox {
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; position: relative; padding-left: 26px;
  font-size: .86rem; color: var(--muted); transition: color .15s;
}
.filter-checkbox:hover { color: var(--text); }
.filter-checkbox input { position: absolute; opacity: 0; cursor: pointer; }
.checkmark {
  position: absolute; left: 0; height: 16px; width: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; transition: all .15s;
}
.filter-checkbox:hover input ~ .checkmark { border-color: var(--primary); }
.filter-checkbox input:checked ~ .checkmark {
  background: var(--primary); border-color: var(--primary);
}
.checkmark:after { content: ""; position: absolute; display: none; }
.filter-checkbox input:checked ~ .checkmark:after { display: block; }
.filter-checkbox .checkmark:after {
  left: 5px; top: 1px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.filter-section-price-range { padding: 6px 0 4px; }
.price-range-values {
  display: flex; justify-content: space-between;
  margin-top: 8px; font-size: .78rem; color: var(--muted);
}

/* noUiSlider theme override */
.listing-sidebar .noUi-target {
  background: var(--border); border: 0; box-shadow: none; height: 4px;
}
.listing-sidebar .noUi-connect { background: var(--primary); }
.listing-sidebar .noUi-handle {
  width: 16px; height: 16px; right: -8px; top: -6px;
  border-radius: 50%; background: var(--secondary);
  border: 2px solid var(--surface); box-shadow: var(--shadow);
  cursor: pointer;
}
.listing-sidebar .noUi-handle::before,
.listing-sidebar .noUi-handle::after { display: none; }
.listing-sidebar .noUi-tooltip {
  background: var(--primary); color: #fff; border: 0;
  border-radius: 20px; padding: 2px 8px; font-size: .72rem;
}

.sidebar-footer {
  display: none; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--surface);
}
.sidebar-footer button {
  flex: 1; padding: 10px 14px; border-radius: 40px;
  font-weight: 500; font-size: .85rem; cursor: pointer;
  transition: all .2s;
}
.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
  background: var(--primary); border: 1px solid var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.close-filter-drawer {
  display: none; background: none; border: none;
  color: var(--muted); cursor: pointer; padding: 4px;
}

/* ---------- 06. TOOLBAR ---------- */
.listing-toolbar {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.toolbar-right {
  display: flex; align-items: center; gap: 12px;
  width: 100%; justify-content: space-between;
}

.search-wrapper { position: relative; flex: 1; max-width: 320px; }
.search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); color: var(--muted);
}
.search-input {
  width: 100%; padding: 10px 14px 10px 38px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 40px; font: inherit; font-size: .86rem;
  color: var(--text); outline: none; transition: border-color .2s;
}
.search-input:focus { border-color: var(--secondary); }

.sort-wrapper { flex: none; }
.sort-select {
  padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 40px; font: inherit; font-size: .86rem;
  font-weight: 500; color: var(--text); cursor: pointer; outline: none;
  transition: border-color .2s;
}
.sort-select:focus { border-color: var(--secondary); }

.mobile-filter { display: none; }
.mobile-filter > button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 40px;
  font: inherit; font-weight: 500; font-size: .86rem;
  cursor: pointer; color: var(--text); box-shadow: var(--shadow);
}
.mobile-filter > button svg { width: 16px; height: 16px; color: var(--primary); }

/* active filter tags */
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  background: var(--primary-soft); color: var(--primary);
  font-size: .78rem; font-weight: 500; border-radius: 40px;
}
.filter-tag button {
  background: none; border: none; color: inherit;
  cursor: pointer; display: flex; align-items: center; padding: 0;
}

/* ---------- 07. PRODUCT GRID ---------- */
/* Grid uses theme's .prod-grid sizing; kept .products-grid as container id class */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
@media (max-width: 1150px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .products-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; } }

/* ---------- 08. PRODUCT CARD — alias to theme .prod look ---------- */
/* JS template uses .product-card* — same visual properties as .prod */
.product-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; transition: .35s;
  text-decoration: none; color: inherit;
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: transparent;
}

.product-card__badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  display: inline-block; padding: 3px 11px; border-radius: 20px;
  background: var(--secondary); color: #fff;
  font-size: .72rem; font-weight: 500;
}
.product-card__badge--green { background: var(--secondary); }
.product-card__badge--accent { background: var(--primary); color: #fff; }

.product-card__wish {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); color: var(--primary);
  display: grid; place-items: center;
  font-size: 1rem; transition: color .2s, transform .2s, background .2s;
  border: 0; cursor: pointer;
}
.product-card__wish:hover { background: var(--primary-soft); transform: scale(1.08); }

.product-card__image-wrapper {
  position: relative; display: grid; place-items: center;
  padding: 20px; background: var(--primary-soft);
  overflow: hidden; aspect-ratio: 1;
}
.product-card__image {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform .5s;
}
.product-card:hover .product-card__image { transform: scale(1.15) rotate(6deg); }

.product-card__info {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px 20px; flex: 1;
}
.product-card__category {
  font-size: .78rem; color: var(--muted); margin: 0;
}
.product-card__title {
  font-family: var(--font-head);
  font-size: 1.25rem; font-weight: 600; line-height: 1.2;
  margin: 2px 0 6px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  transition: color .2s;
}
.product-card:hover .product-card__title { color: var(--primary); }

.product-card__rating {
  color: var(--secondary); font-size: .82rem; letter-spacing: 2px;
}
.product-card__rating span { color: var(--muted); letter-spacing: 0; }

.product-card__delivery {
  font-size: .78rem; color: var(--secondary); font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}

.product-card__foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 6px;
}
.product-card__price { display: flex; align-items: baseline; gap: 8px; }
.product-card__price-current {
  font-weight: 500; font-size: 1.05rem; color: var(--primary);
}
.product-card__price-compare {
  font-size: .8rem; color: var(--muted); text-decoration: line-through;
}

.add-to-cart-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid transparent; cursor: pointer;
  transition: .2s;
}
.add-to-cart-btn svg { width: 16px; height: 16px; }
.add-to-cart-btn:hover {
  background: var(--primary); color: #fff;
  border-color: var(--primary); transform: scale(1.05);
}

@media (max-width: 700px) {
  .product-card__image-wrapper { aspect-ratio: 1; padding: 12px; }
  .product-card__info { padding: 12px; }
  .product-card__title { font-size: 1.05rem; }
  .product-card__price-current { font-size: .98rem; }
}

/* ---------- 09. LOADING INDICATOR ---------- */
.loading-indicator {
  text-align: center; padding: 40px;
  color: var(--muted); font-size: .9rem;
}
.loading-indicator:empty { display: none; }

/* ---------- 10. MOBILE FILTER DRAWER ---------- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(40,10,20,.45);
  z-index: 998; opacity: 0; visibility: hidden;
  pointer-events: none; transition: opacity .3s ease;
}
.sidebar-overlay.open {
  display: block; opacity: 1; visibility: visible; pointer-events: all;
}
@media (max-width: 992px) {
  .listing-sidebar {
    position: fixed; top: 0; left: -100%;
    width: 300px; max-width: 85vw; height: 100%;
    z-index: 999; border-radius: 0; border: none;
    box-shadow: 6px 0 40px rgba(0,0,0,.2);
    display: flex; flex-direction: column; overflow: hidden;
    transition: left .3s ease;
    opacity: 0; visibility: hidden; pointer-events: none;
  }
  .listing-sidebar.open {
    left: 0; opacity: 1; visibility: visible; pointer-events: all;
  }
  .sidebar-body { flex: 1; overflow-y: auto; padding: 0; }
  .sidebar-footer { display: flex; }
  .close-filter-drawer { display: inline-block; }
  .mobile-filter { display: block; }
}
@media (max-width: 640px) {
  .listing-toolbar { padding: 10px 12px; flex-direction: column; align-items: stretch; }
  .toolbar-right { flex-direction: column; align-items: stretch; gap: 10px; }
  .search-wrapper { max-width: none; }
  .sort-wrapper { width: 100%; }
  .sort-select { width: 100%; }
  .mobile-filter { display: block; }
  .mobile-filter > button { width: 100%; justify-content: center; }
}