/* Category listing — paper / jade layout */
.kindle-category {
  --kc-border: var(--ks-border, #E5E1D8);
  --kc-muted: var(--ks-muted, #6B6F76);
  --kc-text: var(--ks-ink, #16181C);
  --kc-surface: var(--ks-white, #fff);
  --kc-hero: var(--ks-sand-fill, #F5F3EE);
  --kc-accent: var(--ks-jade, #0F5F52);
  --kc-accent-hover: var(--ks-jade-hover, #0A4438);
  --kc-tile-bg: #fff;
  --kc-sale: var(--ks-sale, #B4552F);
}

.kindle-category .kindle-category__breadcrumb.breadcrumb {
  margin: 0.75rem 0 0.5rem !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  font-size: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  --bs-breadcrumb-divider: "/";
}

.kindle-category .kindle-category__breadcrumb > li.breadcrumb-item {
  padding: 0 !important;
  text-shadow: none !important;
  position: static !important;
  white-space: normal;
}

.kindle-category .kindle-category__breadcrumb > li.breadcrumb-item:after,
.kindle-category .kindle-category__breadcrumb > li.breadcrumb-item::after {
  content: none !important;
  display: none !important;
  border: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

.kindle-category .kindle-category__breadcrumb > li.breadcrumb-item + li:before,
.kindle-category .kindle-category__breadcrumb > li.breadcrumb-item + li::before,
.kindle-category .kindle-category__breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  content: "/" !important;
  padding: 0 0.4rem !important;
  color: var(--kc-muted) !important;
  float: none !important;
}

.kindle-category .kindle-category__breadcrumb a {
  color: var(--kc-muted);
  text-decoration: none;
}

.kindle-category .kindle-category__breadcrumb a:hover {
  color: var(--kc-accent);
}

.kindle-category .kindle-category__breadcrumb .breadcrumb-item.active,
.kindle-category .kindle-category__breadcrumb .breadcrumb-item:last-child,
.kindle-category .kindle-category__breadcrumb .breadcrumb-item:last-child a {
  color: var(--kc-text);
}

.kindle-category__hero {
  padding: 0.25rem 0 1.25rem;
}

.kindle-category__title {
  margin: 0 0 1rem;
  font-family: var(--ks-display, "Newsreader", serif);
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 700;
  color: var(--kc-text);
  line-height: 1.2;
}

.kindle-category__tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0 0 0.5rem;
}

@media (min-width: 576px) {
  .kindle-category__tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .kindle-category__tiles {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 1rem;
  }
}

.kindle-category__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--kc-text);
  text-align: center;
  min-width: 0;
}

.kindle-category__tile:hover {
  color: var(--kc-accent);
}

.kindle-category__tile-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  max-width: 120px;
  border-radius: 12px;
  background: var(--kc-tile-bg);
  border: 1px solid var(--kc-border);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(22, 24, 28, 0.04);
}

.kindle-category__tile-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.kindle-category__tile-placeholder {
  display: block;
  width: 40%;
  height: 40%;
  border-radius: 8px;
  background: var(--ks-sand, #E9E5DC);
}

.kindle-category__tile-name {
  font-size: 0.8125rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kindle-category__listing {
  background: var(--kc-surface);
  border-top: 1px solid var(--kc-border);
  padding: 1rem 0 2rem;
}

.kindle-category__row {
  align-items: flex-start;
}

.kindle-category #column-left {
  margin-bottom: 1rem;
}

.kindle-category__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--kc-border);
}

.kindle-category__found {
  font-size: 1rem;
  font-weight: 600;
  color: var(--kc-text);
}

.kindle-category__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.kindle-category__sort .form-select,
.kindle-category__limit .form-select {
  min-width: 11rem;
  font-size: 0.875rem;
  border-color: var(--kc-border);
  background-color: #fff;
  border-radius: var(--ks-radius, 12px);
}

.kindle-category__view {
  gap: 0.25rem;
}

.kindle-category__view .btn {
  border: 1px solid var(--kc-border);
  border-radius: 8px;
}

.kindle-category__view .btn.active {
  border-color: var(--kc-accent);
  color: var(--kc-accent);
}

.kindle-category #product-list.kindle-category__grid,
.kindle-category #product-list {
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
  margin-left: 0;
  margin-right: 0;
  border: 1px solid var(--kc-border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.kindle-category #product-list > .col {
  display: flex;
  padding: 0;
  border-right: 1px solid var(--kc-border);
  border-bottom: 1px solid var(--kc-border);
}

.kindle-category #product-list > .col:nth-child(2n) {
  border-right: 0;
}

@media (min-width: 768px) {
  .kindle-category #product-list > .col:nth-child(2n) {
    border-right: 1px solid var(--kc-border);
  }

  .kindle-category #product-list > .col:nth-child(3n) {
    border-right: 0;
  }
}

@media (min-width: 1200px) {
  .kindle-category #product-list > .col:nth-child(3n) {
    border-right: 1px solid var(--kc-border);
  }

  .kindle-category #product-list > .col:nth-child(4n) {
    border-right: 0;
  }
}

.kindle-category #product-list .product-thumb {
  width: 100%;
  border: 0 !important;
  border-radius: 0 !important;
  background: #fff;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  transition: background-color 0.15s ease;
  overflow: hidden;
  box-shadow: none !important;
}

.kindle-category #product-list .product-thumb:hover {
  box-shadow: none !important;
  border-color: transparent !important;
  background: #fff;
  z-index: 1;
}

.kindle-category #product-list .product-thumb .image {
  position: relative;
  aspect-ratio: 1;
  background: #fff;
  margin: 0;
  padding: 0.75rem;
}

.kindle-category #product-list .product-thumb .image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.kindle-category #product-list .product-thumb .content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.85rem 1rem 1rem;
  gap: 0.35rem;
}

.kindle-category #product-list .product-thumb .description {
  flex: 1;
}

.kindle-category #product-list .product-thumb .description p {
  display: none;
}

.kindle-category #product-list .product-thumb h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.6em;
}

.kindle-category #product-list .product-thumb h4 a {
  color: var(--kc-text);
  text-decoration: none;
}

.kindle-category #product-list .product-thumb h4 a:hover {
  color: var(--kc-accent);
}

.kindle-category #product-list .product-thumb .price {
  margin: 0 0 0.5rem;
  font-family: var(--ks-display, "Newsreader", serif);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--kc-text);
}

/* Ціна «5799.00 грн» не повинна ламатися на два рядки у вузьких картках */
.kindle-category #product-list .product-thumb .price-new,
.kindle-category #product-list .product-thumb .price {
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .kindle-category #product-list .product-thumb .price {
    font-size: 1.15rem;
  }
}

.kindle-category #product-list .product-thumb .price-old {
  font-size: 0.875rem;
  font-weight: 400;
  font-family: var(--ks-font, "Manrope", sans-serif);
  color: var(--kc-muted);
  text-decoration: line-through;
  margin-left: 0.35rem;
}

.kindle-category #product-list .product-thumb .price-tax {
  display: none;
}

.kindle-category #product-list .product-thumb .rating {
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
}

.kindle-category #product-list .product-thumb .button {
  display: flex;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.kindle-category #product-list .product-thumb .button button {
  border: 1px solid var(--kc-border);
  background: #fff;
  border-radius: 11px;
  height: 42px;
  padding: 0 16px;
  color: var(--kc-muted);
}

.kindle-category #product-list .product-thumb .button button:first-child {
  flex: 1;
  width: auto;
  background: var(--kc-text);
  border-color: var(--kc-text);
  color: var(--ks-paper, #FBFAF7);
  font-size: 0.875rem;
  font-weight: 700;
}

.kindle-category #product-list .product-thumb .button button:first-child:hover {
  background: var(--kc-accent);
  border-color: var(--kc-accent);
}

.kindle-category #product-list .product-thumb .button button:first-child i {
  margin-right: 0.25rem;
}

/* Stock states via OpenCart stock class if present */
.kindle-category #product-list .product-thumb .stock.in-stock,
.kindle-category #product-list .product-thumb .stock.instock {
  color: var(--kc-accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.kindle-category #product-list .product-thumb .ks-card-code,
.product-thumb .ks-card-code {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ks-muted, #6B6F76);
  margin: 0 0 0.25rem;
}

.ks-pdp-code {
  margin-bottom: 0.35rem !important;
}

.ks-pdp-code__value {
  font-family: var(--ks-display, "Newsreader", serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ks-jade, #0F5F52);
  margin-right: 0.35rem;
}

.ks-pdp-code__hint {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ks-muted, #6B6F76);
}

@media (max-width: 575.98px) {
  .ks-pdp-code__hint {
    display: block;
    margin-top: 0.15rem;
  }
}


.kindle-category__description {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--kc-border);
  color: var(--kc-muted);
  font-size: 0.9375rem;
}

.kindle-category__description img {
  max-width: 100%;
  height: auto;
}

/* Sidebar */
.kindle-sidebar {
  border: 1px solid var(--kc-border);
  border-radius: var(--ks-radius, 12px);
  background: #fff;
  overflow: hidden;
  margin-bottom: 1rem;
}

.kindle-sidebar__title {
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.9375rem;
  font-weight: 700;
  border-bottom: 1px solid var(--kc-border);
  color: var(--kc-text);
}

.kindle-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.kindle-sidebar__item > a,
.kindle-sidebar__child > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  color: var(--kc-text);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.3;
}

.kindle-sidebar__item > a:hover,
.kindle-sidebar__child > a:hover {
  background: var(--ks-mint, #E4EFEB);
  color: var(--kc-accent);
}

.kindle-sidebar__item.is-active > a,
.kindle-sidebar__child.is-active > a {
  font-weight: 600;
  color: var(--kc-accent);
  background: var(--ks-mint, #E4EFEB);
}

.kindle-sidebar__children {
  list-style: none;
  margin: 0;
  padding: 0 0 0.25rem;
}

.kindle-sidebar__child > a {
  padding-left: 1.5rem;
  color: var(--kc-muted);
}

.kindle-sidebar__count {
  color: var(--kc-muted);
  font-size: 0.75rem;
  font-weight: 400;
}

@media (max-width: 767.98px) {
  .kindle-category__sort {
    flex: 1;
  }

  .kindle-category__sort .form-select {
    width: 100%;
    min-width: 0;
  }

  .kindle-category__toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .kindle-category__controls {
    margin-left: 0;
  }
}

/* Hide compare on listing cards */
.kindle-category #product-list .product-thumb .button button[onclick*="compare"],
.kindle-category #product-list .product-thumb .button button[title*="порівнян" i],
#product-list .product-thumb button[onclick*="compare.add"] {
  display: none !important;
}
