/* Novira — Category / product listing page */

.ds-cat-page {
  background: var(--ds-bg-soft);
  padding-bottom: 48px;
}

/* Breadcrumb */
.ds-cat-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ds-text-muted);
  margin-bottom: 16px;
}

.ds-cat-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ds-cat-breadcrumb a {
  color: var(--ds-text-muted);
  text-decoration: none;
}

.ds-cat-breadcrumb a:hover {
  color: var(--ds-brand);
}

.ds-cat-breadcrumb-sep {
  opacity: 0.5;
}

.ds-cat-breadcrumb-current {
  color: var(--ds-text-secondary);
  font-weight: 500;
}

/* Hero */
.ds-cat-hero {
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 20px 16px;
  margin-bottom: 16px;
}

.ds-cat-hero-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.ds-cat-hero h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--ds-text);
  margin: 0;
}

.ds-cat-hero-count {
  font-size: 12px;
  color: var(--ds-text-muted);
}

.ds-cat-hero-desc {
  font-size: 13px;
  color: var(--ds-text-muted);
  line-height: 1.8;
  margin: 0;
}

.ds-cat-hero-desc.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ds-cat-hero-toggle {
  margin-top: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-brand);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

@media (min-width: 768px) {
  .ds-cat-hero {
    padding: 28px 24px;
  }

  .ds-cat-hero h1 {
    font-size: 26px;
  }

  .ds-cat-hero-desc {
    font-size: 14px;
  }
}

/* Subcategory rail */
.ds-cat-subnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  margin-bottom: 16px;
}

.ds-cat-subnav::-webkit-scrollbar {
  display: none;
}

.ds-cat-subnav-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 84px;
  padding: 10px 6px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  text-decoration: none;
  color: var(--ds-text-secondary);
  font-size: 11px;
  text-align: center;
  transition: border-color 0.2s, color 0.2s;
}

.ds-cat-subnav-item:hover {
  border-color: var(--ds-brand);
  color: var(--ds-brand);
}

.ds-cat-subnav-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ds-bg-soft);
  font-size: 20px;
}

/* Layout */
.ds-cat-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 1024px) {
  .ds-cat-layout {
    grid-template-columns: 264px 1fr;
    gap: 24px;
  }
}

.ds-cat-main {
  min-width: 0;
}

/* Sidebar — off-canvas drawer up to 1023px */
.ds-cat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 600;
}

.ds-cat-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  width: min(88vw, 340px);
  z-index: 610;
  background: var(--ds-bg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--ds-shadow-lg);
  /* Page is RTL-only, so the drawer parks past the right edge */
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0.25s;
}

.ds-cat-sidebar.is-open {
  transform: translateX(0);
  visibility: visible;
}

.ds-cat-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ds-border);
  flex-shrink: 0;
}

.ds-cat-sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ds-text);
}

.ds-cat-sidebar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--ds-text-muted);
  cursor: pointer;
}

.ds-cat-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px;
}

.ds-cat-sidebar-foot {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--ds-border);
  flex-shrink: 0;
}

.ds-cat-sidebar-foot button {
  flex: 1;
  min-height: 44px;
  border-radius: var(--ds-radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s, border-color 0.2s;
}

.ds-cat-btn-apply {
  background: var(--ds-brand);
  border: 1px solid var(--ds-brand);
  color: #fff;
}

.ds-cat-btn-apply:hover {
  filter: brightness(0.92);
}

.ds-cat-btn-reset {
  flex: 0 0 auto !important;
  padding-inline: 20px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  color: var(--ds-text-secondary);
}

.ds-cat-btn-reset:hover {
  border-color: var(--ds-brand);
  color: var(--ds-brand);
}

@media (min-width: 1024px) {
  .ds-cat-backdrop {
    display: none;
  }

  .ds-cat-sidebar {
    position: sticky;
    top: 88px;
    inset-inline-end: auto;
    width: auto;
    max-height: 100vh ;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    box-shadow: none;
    transform: none;
    visibility: visible;
  }

  .ds-cat-sidebar-close {
    display: none;
  }

  .ds-cat-sidebar-body {
    padding-inline: 16px;
  }

  .ds-cat-sidebar-foot {
    display: none;
  }
}

/* Filter groups */
.ds-cat-filter {
  border-bottom: 1px solid var(--ds-border);
}

.ds-cat-filter:last-child {
  border-bottom: none;
}

.ds-cat-filter-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ds-text-secondary);
  cursor: pointer;
}

.ds-cat-filter-head svg {
  flex-shrink: 0;
  color: var(--ds-text-muted);
  transition: transform 0.2s;
}

.ds-cat-filter-head[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.ds-cat-filter-body {
  padding-bottom: 16px;
}

.ds-cat-filter-scroll {
  max-height: 100vh;
  overflow-y: auto;
}

/* Option rows */
.ds-cat-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  font-size: 13px;
  color: var(--ds-text-secondary);
  cursor: pointer;
}

.ds-cat-option input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--ds-brand);
  cursor: pointer;
}

.ds-cat-option-label {
  flex: 1;
  min-width: 0;
}

.ds-cat-option-count {
  font-size: 11px;
  color: var(--ds-text-muted);
}

.ds-cat-option:hover .ds-cat-option-label {
  color: var(--ds-brand);
}

/* Toggle switch */
.ds-cat-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-text-secondary);
  cursor: pointer;
}

.ds-cat-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ds-cat-switch-track {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--ds-border);
  transition: background 0.2s;
}

.ds-cat-switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.ds-cat-switch input:checked + .ds-cat-switch-track {
  background: var(--ds-brand);
}

.ds-cat-switch input:checked + .ds-cat-switch-track::after {
  transform: translateX(-18px);
}

.ds-cat-switch input:focus-visible + .ds-cat-switch-track {
  box-shadow: 0 0 0 2px rgba(239, 64, 86, 0.3);
}

/* Price range */
.ds-cat-price-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ds-text-secondary);
  margin-bottom: 12px;
}

.ds-cat-price-values strong {
  font-weight: 700;
  color: var(--ds-text);
}

.ds-cat-price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ds-cat-price-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ds-bg-soft);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  padding: 8px 10px;
}

.ds-cat-price-field:focus-within {
  border-color: var(--ds-brand);
}

.ds-cat-price-field input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--ds-text);
}

.ds-cat-price-field span {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ds-text-muted);
}

.ds-cat-price-slider {
  width: 100%;
  margin-top: 12px;
  accent-color: var(--ds-brand);
}

/* Color swatches */
.ds-cat-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ds-cat-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--ds-border);
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: box-shadow 0.2s;
}

.ds-cat-swatch:hover {
  box-shadow: 0 0 0 2px rgba(239, 64, 86, 0.2);
}

.ds-cat-swatch.is-active {
  box-shadow: 0 0 0 2px var(--ds-bg), 0 0 0 4px var(--ds-brand);
}

/* Toolbar */
.ds-cat-toolbar {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  padding: 8px 12px;
  margin-bottom: 16px;
}

@media (min-width: 1024px) {
  .ds-cat-toolbar {
    display: flex;
  }
}

.ds-cat-toolbar-label {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ds-text-secondary);
}

.ds-cat-sort {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ds-cat-sort::-webkit-scrollbar {
  display: none;
}

.ds-cat-sort-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: var(--ds-radius);
  font-family: inherit;
  font-size: 13px;
  color: var(--ds-text-muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.ds-cat-sort-btn:hover {
  color: var(--ds-text);
}

.ds-cat-sort-btn.is-active {
  color: var(--ds-brand);
  font-weight: 700;
  background: rgba(239, 64, 86, 0.08);
}

.ds-cat-toolbar-end {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ds-cat-result-count {
  font-size: 12px;
  color: var(--ds-text-muted);
  white-space: nowrap;
}

.ds-cat-view {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--ds-bg-soft);
  border-radius: var(--ds-radius);
}

.ds-cat-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 6px;
  color: var(--ds-text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ds-cat-view-btn.is-active {
  background: var(--ds-bg);
  color: var(--ds-brand);
  box-shadow: var(--ds-shadow);
}

/* Mobile filter/sort bar */
.ds-cat-mobile-bar {
  position: sticky;
  top: 64px;
  z-index: 400;
  display: flex;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 8px;
  background: var(--ds-bg-soft);
}

.ds-cat-mobile-bar button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-text-secondary);
  cursor: pointer;
}

.ds-cat-mobile-bar button.has-value {
  border-color: var(--ds-brand);
  color: var(--ds-brand);
}

.ds-cat-mobile-bar .ds-cat-view {
  flex: 0 0 auto;
}

.ds-cat-mobile-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ds-brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

@media (min-width: 1024px) {
  .ds-cat-mobile-bar {
    display: none;
  }
}

/* Sort bottom sheet (mobile) */
.ds-cat-sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 610;
  background: var(--ds-bg);
  border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--ds-shadow-lg);
}

.ds-cat-sheet-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ds-text);
  padding: 12px 0;
  border-bottom: 1px solid var(--ds-border);
  margin-bottom: 4px;
}

.ds-cat-sheet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 0 4px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--ds-text-secondary);
  cursor: pointer;
}

.ds-cat-sheet-option.is-active {
  color: var(--ds-brand);
  font-weight: 700;
}

/* Active filter chips */
.ds-cat-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.ds-cat-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ds-text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.ds-cat-active-chip:hover {
  border-color: var(--ds-brand);
  color: var(--ds-brand);
}

.ds-cat-active-clear {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ds-brand);
  cursor: pointer;
}

/* Product grid */
.ds-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 640px) {
  .ds-cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .ds-cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .ds-cat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Cards stretch to the grid track instead of the swiper's fixed width */
.ds-cat-grid .ds-product-card-wrap.ds-product-card--rich {
  width: auto;
  min-width: 0;
  height: 100%;
  padding: 12px;
}

.ds-cat-grid .ds-product-card-wrap.ds-product-card--rich .ds-product-discount {
  top: 12px;
  left: 12px;
}

/* Square media keeps card rows aligned; the rich card defaults to auto height */
.ds-cat-grid:not(.ds-cat-grid--list) .ds-product-card-wrap.ds-product-card--rich .ds-product-img-wrap {
  aspect-ratio: 1;
  min-height: 0;
}

@media (min-width: 768px) {
  .ds-cat-grid .ds-product-card-wrap.ds-product-card--rich {
    padding: 16px;
  }

  .ds-cat-grid .ds-product-card-wrap.ds-product-card--rich .ds-product-discount {
    top: 16px;
    left: 16px;
  }
}

.ds-cat-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ds-cat-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--ds-bg-soft);
  color: var(--ds-text-muted);
}

.ds-cat-badge--fast {
  background: rgba(0, 160, 73, 0.1);
  color: var(--ds-green);
}

.ds-cat-badge--stock {
  background: rgba(239, 64, 86, 0.08);
  color: var(--ds-brand);
}

.ds-cat-card-desc {
  display: none;
}

/* List view */
.ds-cat-grid--list {
  grid-template-columns: 1fr;
  gap: 12px;
}

.ds-cat-grid--list .ds-product-card__main {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
}

/* Specificity has to beat .ds-product-card-wrap.ds-product-card--rich .ds-product-img-wrap */
.ds-cat-grid--list .ds-product-card-wrap.ds-product-card--rich .ds-product-img-wrap {
  flex-shrink: 0;
  width: 104px;
  min-height: 104px;
  height: 104px;
}

.ds-cat-grid--list .ds-cat-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ds-cat-grid--list .ds-product-card-wrap.ds-product-card--rich .ds-product-title {
  min-height: 0;
}

.ds-cat-grid--list .ds-cat-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  color: var(--ds-text-muted);
  line-height: 1.7;
  margin: 0;
}

@media (min-width: 768px) {
  .ds-cat-grid--list .ds-product-card-wrap.ds-product-card--rich .ds-product-img-wrap {
    width: 160px;
    height: 160px;
    min-height: 160px;
  }

  .ds-cat-grid--list .ds-product-card__main {
    gap: 20px;
  }

  /* Media | details | actions sit side by side on a wide list row */
  .ds-cat-grid--list .ds-product-card-wrap.ds-product-card--rich {
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
  }

  /* Keep the badge over the thumbnail (start edge) rather than the action column */
  .ds-cat-grid--list .ds-product-card-wrap.ds-product-card--rich .ds-product-discount {
    left: auto;
    inset-inline-start: 16px;
  }

  .ds-cat-grid--list .ds-card-actions {
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    width: 132px;
    margin-top: 0;
    padding-top: 0;
    padding-inline-start: 16px;
    border-top: none;
    border-inline-start: 1px solid var(--ds-border);
  }

  .ds-cat-grid--list .ds-card-action {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 6px;
    min-height: 38px;
  }

  .ds-cat-grid--list .ds-card-action-label {
    font-size: 12px;
  }
}

/* Grid view keeps the compact body wrapper transparent */
.ds-cat-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* Empty state */
.ds-cat-empty {
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 48px 24px;
  text-align: center;
}

.ds-cat-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.ds-cat-empty h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ds-text);
  margin: 0 0 6px;
}

.ds-cat-empty p {
  font-size: 13px;
  color: var(--ds-text-muted);
  margin: 0 0 16px;
}

.ds-cat-empty-btn {
  min-height: 44px;
  padding-inline: 24px;
  border-radius: var(--ds-radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* Pagination */
.ds-cat-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}

.ds-cat-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.ds-cat-page-btn:hover:not(:disabled) {
  border-color: var(--ds-brand);
  color: var(--ds-brand);
}

.ds-cat-page-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.ds-cat-page-btn.is-active {
  background: var(--ds-brand);
  border-color: var(--ds-brand);
  color: #fff;
}

.ds-cat-page-dots {
  min-width: 24px;
  text-align: center;
  color: var(--ds-text-muted);
  font-size: 13px;
}

.ds-cat-page-status {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: var(--ds-text-muted);
  margin-top: 8px;
}

/* SEO text block */
.ds-cat-seo {
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 20px 16px;
  margin-top: 28px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--ds-text-muted);
}

.ds-cat-seo h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ds-text-secondary);
  margin: 0 0 8px;
}

@media (min-width: 768px) {
  .ds-cat-seo {
    padding: 24px;
  }
}
