/* Category listing (פירות טריים / ירקות) */

.cat-page {
  background: #f5f5f4;
}

.cat-breadcrumb {
  padding: 16px 0 8px;
  font-size: 15px;
  color: var(--muted);
  border-bottom: 1px solid #e5e5e5;
  background: #fff;
}

.cat-breadcrumb__inner {
  width: min(1700px, 100% - 34px);
  margin: 0 auto;
  padding-inline: 17px;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 6px;
  align-items: center;
}

.cat-breadcrumb__current {
  color: var(--text);
  font-weight: 600;
}

/* Horizontal subcategory strip (live פירות page) */
.cat-subchips {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  padding: 10px 0 14px;
  margin: 0;
}

.cat-subchips__inner {
  width: min(1700px, 100% - 34px);
  margin: 0 auto;
  padding-inline: 17px;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  justify-content: center;
}

.cat-subchips a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 15px;
  color: var(--green-dark);
  background: #f3f6ed;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.cat-subchips a:hover {
  background: #e8efd9;
}

.cat-subchips a.is-active {
  background: var(--green-band);
  border-color: rgba(30, 62, 32, 0.12);
  font-weight: 700;
}

.cat-breadcrumb a {
  color: var(--green-dark);
}

.cat-breadcrumb a:hover {
  text-decoration: underline;
}

.cat-breadcrumb .sep {
  color: #bbb;
  user-select: none;
}

/* Full-width category hero — cap height so tall source assets (e.g. חדש על המדף) match live strip banners */
.cat-hero {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-bottom: 1px solid #e8e8e8;
  background: #f8e8ec;
  container-type: inline-size;
  container-name: cat-hero;
}

.cat-hero__picture {
  display: block;
  line-height: 0;
}

.cat-hero__bg {
  display: block;
  width: 100%;
  /* Match live mega-menu banner proportion (~1920×420), capped — tall PNGs no longer stretch by intrinsic height */
  /* cqw = % of .cat-hero width (no 100vw scrollbar gap); fallback for older browsers */
  height: min(calc(100vw * 420 / 1920), 260px);
  height: min(calc(100cqw * 420 / 1920), 260px);
  min-height: 140px;
  object-fit: cover;
  object-position: center center;
}

.cat-hero__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px min(32px, 4vw);
  box-sizing: border-box;
  pointer-events: none;
}

.cat-hero__title {
  font-family: Marom, sans-serif;
  color: #264022;
  font-size: clamp(1.85rem, 4.2vw, 2.65rem);
  margin: 0 0 14px;
  line-height: 1.15;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.35);
}

.cat-hero__subtitle {
  margin: 0;
  max-width: 56rem;
  color: #264022;
  font-size: clamp(0.95rem, 1.9vw, 1.15rem);
  line-height: 1.65;
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
}

/* Simple title block (e.g. ירקות) */
.cat-intro {
  background: #fff;
  padding: 22px 0 28px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

.cat-intro__inner {
  width: min(920px, 100% - 32px);
  margin: 0 auto;
  padding-inline: 17px;
}

.cat-intro h1 {
  font-family: Marom, sans-serif;
  color: var(--green-dark);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin: 0 0 12px;
  line-height: 1.15;
}

.cat-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.cat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  width: min(1700px, 100% - 34px);
  margin: 0 auto;
  padding: 28px 17px 80px;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .cat-layout {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    gap: 20px;
    padding-inline: 12px;
    padding-top: 16px;
  }

  /* PLP with horizontal subchips (פירות / ירקות): hide sidebar on narrow screens — chips + toolbar carry nav. */
  main.cat-page:has(> .cat-subchips) .cat-sidebar {
    display: none !important;
  }
}

/*
 * Category PLP ≤1150px: live mobile hides the breadcrumb bar; keep pill strip + grid.
 */
@media (max-width: 1150px) {
  main.cat-page > .cat-breadcrumb {
    display: none !important;
  }

  .cat-subchips {
    background: #fff;
    padding: 10px 0 12px;
    border-bottom: 1px solid #e8e8e8;
  }

  .cat-subchips__inner {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding-inline: 16px;
    scroll-padding-inline: 16px;
    gap: 10px;
    padding-bottom: 4px;
  }

  .cat-subchips a {
    flex: 0 0 auto;
    display: inline-block;
    width: auto;
    height: auto;
    padding: 8px 14px;
    border-radius: 999px;
    font-family: Marom, sans-serif;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
    text-align: center;
    color: var(--green-dark);
    background: #f0f4e8;
    border: 1px solid transparent;
    box-sizing: border-box;
    hyphens: none;
    word-break: normal;
  }

  .cat-subchips a.is-active {
    width: auto;
    height: auto;
    font-size: 15px;
    font-weight: 700;
    background: var(--green-band);
    border-color: rgba(30, 62, 32, 0.12);
    color: var(--green-dark);
  }

  main.cat-page:has(.cat-hero) {
    display: flex;
    flex-direction: column;
  }

  main.cat-page:has(.cat-hero) > .cat-hero {
    order: 1;
  }

  main.cat-page:has(.cat-hero) > .cat-subchips {
    order: 2;
  }

  main.cat-page:has(.cat-hero) > .cat-layout {
    order: 3;
  }
}

.cat-sidebar {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ebebeb;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  padding: 22px 18px;
  align-self: start;
}

.cat-sidebar h2 {
  font-family: Marom, sans-serif;
  font-size: 1.25rem;
  color: var(--green-dark);
  margin: 0 0 14px;
}

.cat-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cat-sidebar__list a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text);
  transition: background 0.15s;
}

.cat-sidebar__list a:hover {
  background: #f5f5f5;
}

.cat-sidebar__list a.is-active {
  background: #e8f2d4;
  color: var(--green-dark);
  font-weight: 700;
  border: 1px solid rgba(164, 214, 104, 0.5);
}

.cat-filters {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.cat-filters summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--green-dark);
  padding: 8px 0;
  list-style: none;
}

.cat-filters summary::-webkit-details-marker {
  display: none;
}

.cat-filters__group {
  margin-top: 8px;
}

.cat-filters label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.9rem;
  cursor: pointer;
}

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

.cat-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 20px;
}

.cat-toolbar select {
  min-width: 200px;
  padding: 10px 36px 10px 14px;
  border-radius: 6px;
  border: 1px solid #c5c5c5;
  font-family: inherit;
  font-size: 16px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

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

@media (min-width: 1500px) {
  .cat-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.cat-card {
  position: relative;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Image-only tile (live PLP: title + price sit on gray page bg below) */
.cat-card__media {
  position: relative;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.cat-card:hover .cat-card__media {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border-color: #d8d8d8;
}

.cat-card__badges {
  position: absolute;
  top: 8px;
  inset-inline: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  z-index: 2;
  pointer-events: none;
}

.cat-card__badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cat-card__badge--sale {
  background: #f5e6a3;
  color: #5c4a00;
  border: 1px solid rgba(200, 170, 40, 0.45);
}

.cat-card__badge--new {
  margin-inline-start: auto;
  background: #1e6fd9;
  color: #fff;
  border: 1px solid rgba(20, 80, 180, 0.35);
}

.cat-card__img {
  aspect-ratio: 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 12px;
}

.cat-card__img img {
  max-width: 100%;
  max-height: 168px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* IL regional indicators → 🇮🇱; font matches smartTerminal browser app (Twemoji Country Flags) */
.cat-card__flag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  /* Above hover qty strip (z-index 4) so the flag stays visible */
  z-index: 7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 1.35rem;
  width: auto;
  height: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18));
}

.cat-card__flag::before {
  content: "\1F1EE\1F1F1";
  font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
    "Noto Color Emoji", emoji, sans-serif;
}

/* Hover quantity strip + remove (desktop / fine pointer — see bottom: mobile hides) */
.cat-card__remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #5a5a5a;
  cursor: pointer;
  transition: color 0.15s ease, opacity 0.15s ease, visibility 0.15s ease;
}

.cat-card__remove:hover,
.cat-card__remove:focus-visible {
  color: #222;
}

.cat-card__qty-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 12px 12px;
  direction: ltr;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.94) 38%, #fff 100%);
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.cat-card__qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e0e0e0;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.cat-card__qty-btn:hover:not(:disabled),
.cat-card__qty-btn:focus-visible:not(:disabled) {
  background: #d0d0d0;
}

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

.cat-card__qty-num {
  min-width: 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

/* Desktop: hide bottom green + ; show grey stepper + X only on hover */
@media (hover: hover) and (pointer: fine) {
  .cat-grid .cat-card__actions {
    display: none !important;
  }

  .cat-grid .cat-card__remove {
    display: flex;
  }

  .cat-grid .cat-card__qty-bar {
    display: flex;
  }

  .cat-grid .cat-card__remove,
  .cat-grid .cat-card__qty-bar {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .cat-grid .cat-card:hover .cat-card__remove,
  .cat-grid .cat-card:focus-within .cat-card__remove,
  .cat-grid .cat-card:hover .cat-card__qty-bar,
  .cat-grid .cat-card:focus-within .cat-card__qty-bar {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

/* Touch / coarse pointer: no hover overlay — keep classic + button */
@media (hover: none), (pointer: coarse) {
  .cat-grid .cat-card__remove,
  .cat-grid .cat-card__qty-bar {
    display: none !important;
  }
}

.cat-card__body {
  padding: 12px 2px 0;
  margin-top: 0;
  text-align: center;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.cat-card__title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 2px;
  line-height: 1.25;
  color: var(--text);
}

.cat-card__price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 8px;
  margin-top: 0;
  margin-bottom: 4px;
}

.cat-card__price {
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--text);
}

.cat-card__unit {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
}

.cat-card__old {
  font-size: 0.88rem;
  color: #9a9a9a;
  text-decoration: line-through;
  font-weight: 500;
}

.cat-card__meta {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.cat-card__plus {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #7cb342;
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(124, 179, 66, 0.35);
}

.cat-card__plus:hover {
  background: #6a9e38;
}

.cat-card__actions {
  margin-top: auto;
  padding-top: 12px;
}

/* Mobile: compact horizontal list (thumb | title + price + add) — overrides above */
@media (max-width: 900px) {
  .cat-toolbar {
    margin-bottom: 12px;
    justify-content: stretch;
  }

  .cat-toolbar select {
    width: 100%;
    min-width: 0;
    font-size: 15px;
  }

  .cat-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .cat-card {
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .cat-grid .cat-card__remove,
  .cat-grid .cat-card__qty-bar {
    display: none !important;
  }

  .cat-grid .cat-card__actions {
    display: block !important;
  }

  .cat-card:has(> .cat-card__media) > .cat-card__media {
    flex: 0 0 32%;
    max-width: 120px;
    min-width: 88px;
    display: flex;
    flex-direction: column;
    position: relative;
    align-self: stretch;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
  }

  .cat-card:hover .cat-card__media {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d8d8d8;
  }

  .cat-card:has(> .cat-card__media) .cat-card__img {
    flex: 1;
    aspect-ratio: 1;
    min-height: 0;
    max-height: 108px;
    padding: 6px 8px;
  }

  .cat-card:has(> .cat-card__media) .cat-card__img img {
    max-height: 96px;
  }

  .cat-card:not(:has(> .cat-card__media)) {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .cat-card:not(:has(> .cat-card__media)) > .cat-card__img {
    grid-column: 1;
    grid-row: 1;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    aspect-ratio: unset;
    min-height: 88px;
    max-height: 104px;
    height: 100%;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .cat-card:not(:has(> .cat-card__media)) > .cat-card__img img {
    max-height: 92px;
  }

  .cat-card:not(:has(> .cat-card__media)) > .cat-card__flag {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    margin: 0 0 4px 4px;
    position: relative;
    z-index: 7;
    left: auto;
    bottom: auto;
    font-size: 1.2rem;
    width: auto;
    height: auto;
  }

  .cat-card:not(:has(> .cat-card__media)) > .cat-card__body {
    grid-column: 2;
    grid-row: 1;
  }

  .cat-card__badges {
    top: 4px;
    inset-inline: 4px;
  }

  .cat-card__badge {
    font-size: 0.6rem;
    padding: 3px 8px;
  }

  .cat-card:has(> .cat-card__media) .cat-card__flag {
    left: 5px;
    bottom: 5px;
    font-size: 1.2rem;
    width: auto;
    height: auto;
  }

  .cat-card .cat-card__body {
    padding: 8px 10px 10px;
    text-align: right;
    flex: 1;
    min-width: 0;
    justify-content: center;
  }

  .cat-card__title {
    font-size: 0.9rem;
    margin: 0 0 4px;
    min-height: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .cat-card__price-row {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 3px 6px;
    margin-bottom: 0;
  }

  .cat-card__price {
    font-size: 0.95rem;
  }

  .cat-card__old {
    font-size: 0.78rem;
  }

  .cat-card__unit {
    font-size: 0.75rem;
  }

  .cat-card__meta {
    font-size: 0.72rem;
    margin: 0 0 4px;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .cat-card__actions {
    margin-top: 6px;
    padding-top: 0;
    align-self: flex-end;
  }

  .cat-card__plus {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }
}
