/* ============================================
   1. GRID CONTAINER
   ============================================ */
.items.grid {
  display: grid;
  /* Jediná definícia gridu pre všetky zobrazenia */
  grid-template-columns: repeat(auto-fit,
      minmax(var(--card-width, 280px), 1fr));
  gap: 1px;
  /* background-color: var(--color-border);
  border: 1px solid var(--color-border); */
  border-radius: 12px;
  overflow: hidden;
  /*margin: -1px;*/
  /* Kompenzácia pre vonkajšie okraje */
}

/* ============================================
   2. ITEM CARD (Základná štruktúra)
   ============================================ */
.items .item {
  display: flex;
  flex-direction: column;
  /* display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: inherit; */
  background-color: var(--item-bg);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.items .item:hover {
  /* z-index: 2;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px); */
}

.items .item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* ============================================
   3. IMAGE WRAPPER & BADGES
   ============================================ */
.items .img-wrapper {
  /* position: relative; */
  aspect-ratio: 16 / 9;
  /* Vyvážený pomer strán */
  display: flex;
  align-items: center;
  /* flex-grow: 1; sposobuje ze nie vsetky obrazky maju rovnaku vysku */
  justify-content: center;
  padding: 1rem;
  background-color: var(--item-bg);
}

.items .image img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.items .item:hover .image img {
  transform: scale(1.05);
  --speed: 0.25s;
  --anim: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transition: transform var(--speed) var(--anim);
}

/* Štýl pre zľavový štítok */
.items .discount-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background-color: var(--color-red, #dc2626);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.75rem;
  z-index: 1;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
}

.items .discount-badge::before {
  content: "-";
}

.items .discount-badge::after {
  content: "%";
}

/* Indikátor variantov (+1 varianta) */
.items .img-wrapper .placeholder {
  position: absolute;
  bottom: 0.5rem;
  right: 0;
  background: var(--item-bg);
  border-radius: 0.5rem 0 0 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 1;
}

/* ============================================
   4. CONTENT (Brand, Title, Price)
   ============================================ */
.items .content-wrapper {
  padding: 1.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.items .brand-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}

.items .brand {
  font-size: 0.75rem;
  color: var(--orange-500);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  /* Tieto tri vlastnosti zabezpečia správne správanie v jednom riadku: */
  white-space: nowrap;
  /* Zabráni zalomeniu riadku */
  overflow: hidden;
  /* Skryje pretekajúci text (kompatibilnejšie ako clip) */
  text-overflow: ellipsis;
  /* (Voliteľné) Pridá tri bodky (...), ak je text príliš dlhý */
}

.items .eshop {
  font-size: 0.75rem;
  color: var(--btn-text);
  background: var(--app-bg-2-active);
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Obmedzenie nadpisu na 2 riadky */
.items .item-title {
  color: var(--slate-900);
  font-size: 1rem;
  line-height: 1.35;
  height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.items .item:hover .item-title {
  color: rgb(251 146 60);
}

/* Sekcia cien */
.items .item-price {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prices {
  display: flex;
  flex-direction: column;
}

.old {
  color: var(--btn-text);
  text-decoration: line-through;
  font-size: 0.875rem;
  font-weight: 500;
}

.current {
  color: var(--color-red);
  font-size: 1.5rem;
  font-weight: 900;
}

/* ============================================
   5. BUTTONS & FOOTER INFO
   ============================================ */
.items .btn-view-details {
  /* background-color: var(--orange-500); */
  background-color: var(--item-btn);
  color: var(--item-btn-text);
  border: none;
  /* padding: 0.6rem 1rem; */
  border-radius: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s;
}

.items .btn-view-details:hover {
  background-color: var(--color-orange-dark);
}

.items .btn-view-details svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Spodná lišta s informáciou o úspore */
.items .discount-info {
  --highlight-bg: var(--green-light);
  --highlight-text: var(--green-dark);
  background-color: var(--highlight-bg);
  color: var(--highlight-text);
  padding: 0.6rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid var(--highlight-border);
}

.items .discount-info .icon {
  width: 14px;
  height: 14px;
}

/* category heading */
.category-heading {
  position: relative;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  margin-block-end: var(--hwrap);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

@media screen and (max-width: 600px) {
  .category-heading .btn .title {
    display: none;
  }
}

.category-heading h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.category-heading::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 3px;
  background: #f97316;
  border-radius: 2px;
}

/* active filters style */
.active-filters-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  &:has(.filter-tag) {
    margin: 1rem 0;
  }
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: default;
  transition: all 0.2s;
  max-width: 300px;
}

.filter-tag:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #1e293b;
}

.filter-tag .tag-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.simple-close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.125rem;
  /* margin-left: 4px; */
  cursor: pointer;
  border-radius: 50%;
  color: #94a3b8;
  transition: all 0.2s;
}

.simple-close:hover {
  background: #e2e8f0;
  color: #ef4444;
}

.simple-close svg {
  width: 14px;
  height: 14px;
  stroke-width: 3px;
}

/* active filters style */
/* ============================================
   6. RESPONSIVE (Tablet & Mobile)
   ============================================ */
@media screen and (max-width: 1024px) {
  .items.grid {
    --card-width: 210px;
  }

  .items .img-wrapper {
    aspect-ratio: 16 / 9;
    padding: 0.75rem;
  }

  .items .image img {
    max-height: 160px;
  }

  /* Na mobile skryjeme text v tlačidle, ostane len šípka */
  .btn-view-details {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }

  .btn-view-details .caption {
    display: none;
  }

  .items .item-price .current {
    font-size: 1.2rem;
  }

  /* Skrytie info lišty pre úsporu vertikálneho miesta */
  .items .discount-info {
    display: none;
  }

  .items .discount-badge {
    top: 0.5rem;
    left: 0.5rem;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
}

/* ============================================
   PAGING & LOADING
============================================ */
.loading-wrapper {
  padding-block-start: 2rem;
  margin-block-start: var(--hwrap);
  border-top: 1px solid var(--color-border);

  div + div {
    padding-block-start: 2rem;
  }
}

.paging-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.showing-count {
  font-size: var(--font-size-sm);
  color: var(--slate-500-400);
}

.showing-count span {
  color: var(--slate-900);
  font-weight: 700;
}

.paging,
.paging-wrapper {
  display: flex;
}

.paging {
  align-items: center;
  gap: 0.25rem;
  margin-inline: 0.5rem;

  .arrow {
    color: var(--color-text-secondary);
  }
}

.paging-info {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.showing-count {
  color: var(--color-text-secondary);

  span {
    font-weight: 500;
    color: var(--slate-900);
  }
}

/* ============================================
   7. CONTAINER QUERIES & RESPONSIVE REFACTORED
   ============================================ */
.items.grid {
  --card-width: 260px;
  display: grid;
  /* auto-fill je na eshopy lepšie ako auto-fit */
  grid-template-columns: repeat(auto-fill,
      minmax(min(100%, var(--card-width, 280px)), 1fr));
  gap: 1px;
  /* background-color: var(--color-border); */
  /* border: 1px solid var(--color-border); */
  border-radius: 12px;
  overflow: hidden;
}

/* .items.list {
  display: grid;
  grid-template-columns: 1fr;

  .item {
    display: grid;
    grid-template-areas: "image desc" "info info";
    grid-auto-columns: 1fr;
    grid-template-rows: 20rem;

    .img-wrapper {
      display: grid;
      grid-area: image;
      aspect-ratio: 1 / 1;
    }

    .content-wrapper {
      grid-area: desc;
    }

    .discount-info {
      grid-area: info;
      grid-column: 1 / 3;
    }
  }
} */
@media screen and (max-width: 400px) {
  .items.grid {
    --card-width: 140px;
    /* Toto vytvorí 2 stĺpce na malých mobiloch */
  }
}

.items.grid .item {
  container-type: inline-size;
  /* Karta je kontajner */
  display: grid;
  grid-template-columns: 100%;
  grid-template-rows: 14rem auto auto;
  /* Default: jeden stĺpec (vertikálne) */
  background-color: var(--item-bg);
  min-height: 100%;
  border-left: 1px solid var(--color-border);
  margin-left: -1px;
  border-top: 1px solid var(--color-border);
  margin-top: -1px;
  --speed: 0.25s;
  --anim: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transition: transform var(--speed) var(--anim);

  > div {
    /* padding-inline: 2rem; */
  }

  > div:first-child {
    /* padding-top: 1rem; */
  }

  > div:last-child {
    /* padding-bottom: 1rem; */
  }
}

/* ŠTÝL PRE ŠIROKÚ KARTU (Horizontal / List view) */
/* Aktivuje sa len vtedy, ak má JEDNA KARTA viac ako 450px (napr. na tablete v riadku) */
@container (min-width: 450px) {
  .items .item {
    grid-template-columns: 200px 1fr;
    /* Obrázok vľavo, text vpravo */
  }

  .items .img-wrapper {
    aspect-ratio: 1 / 1;
    height: 100%;
  }

  .items .discount-info {
    grid-column: 2;
    /* Info o úspore dáme pod text */
  }
}

/* ŠTÝL PRE MALÚ KARTU (2 stĺpce na mobile) */
@container (max-width: 200px) {
  .items .item-title {
    font-size: 0.8rem;
    height: 3em;
  }

  .items .current {
    font-size: 1.1rem;
  }

  .items .btn-view-details .caption {
    display: none;
    /* Skryjeme text "uchmatni", necháme len šípku */
  }

  .items .content-wrapper {
    padding: 0.75rem;
  }
}