/* ============================================================
   MISTPRO — KATALOG (stránka /katalog)
   Zdroj pravdy: reference/design-kit.md v1.1 + reference/mistpro-katalog.html.
   Vlastník: agent „katalog". Bloky :root, .btn, .card a .grid jsou
   zkopírovány 1:1 z design kitu — případná duplicita s base CSS je
   záměrná a neškodná (hodnoty jsou identické).
   ============================================================ */

:root {
  /* ===== BARVY ===== */
  --bg: #ffffff;
  --surface: #f5f5f7;
  --surface-dark: #06070d;
  --text: #06070d;
  --text-muted: #6e6e73;
  --text-inverse: #f5f5f7;
  --accent: #0071e3;
  --accent-hover: #2997ff;
  --sale: #d70015;              /* VÝHRADNĚ peníze: slevové badge, %, AKCE */
  --success: #248a3d;           /* VÝHRADNĚ dostupnost (Skladem) */
  --hairline: rgba(6, 7, 13, 0.08);
  --hairline-dark: rgba(255, 255, 255, 0.14);

  /* ===== RADIUSY ===== */
  --radius-card: 18px;
  --radius-tile: 12px;
  --radius-pill: 980px;

  /* ===== STÍNY ===== */
  --shadow-rest: 0 1px 2px rgba(6, 7, 13, 0.04);
  --shadow-hover: 0 8px 24px rgba(6, 7, 13, 0.08);

  /* ===== SPACING (4pt) ===== */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  /* ===== TYPOGRAFIE ===== */
  --fs-h1: 28px;
  --fs-h2: 22px;
  --fs-h3: 17px;
  --fs-body: 15px;
  --fs-card-title: 15px;
  --fs-price: 17px;
  --fs-price-old: 13px;
  --fs-meta: 12px;

  /* ===== LAYOUT ===== */
  --container: 1100px;
  --header-h: 56px;
}

/* Ceny a čísla vždy tabulkově */
.price, .price-old { font-variant-numeric: tabular-nums; }

/* Hover zdvih karty jen na zařízeních s myší */
@media (hover: hover) {
  .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
}

/* ===== HLAVIČKA VÝPISU ===== */
.page-head { padding: var(--sp-4) 0; }
.page-head h1 {
  font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.02em;
  display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap;
}
.page-count {
  font-size: var(--fs-body); font-weight: 400; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
/* Echo hledaného dotazu pod H1 (hledání z hlavičky) */
.search-echo { margin-top: var(--sp-1); color: var(--text-muted); font-size: var(--fs-body); }
@media (min-width: 1100px) { .page-head h1 { font-size: 44px; } }

/* ===== LAYOUT: FILTRY + OBSAH ===== */
.catalog-layout { padding-bottom: var(--sp-7); }
@media (min-width: 1100px) {
  .catalog-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: var(--sp-6);
    align-items: start;
  }
}

/* ===== PANEL FILTRŮ (<details> — mobil vysouvací, desktop otevřený sloupec) ===== */
.filters { margin-bottom: var(--sp-4); }
.filters-summary {
  list-style: none;
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 40px; padding: 0 var(--sp-5);
  border: 1px solid var(--accent); border-radius: var(--radius-pill);
  color: var(--accent); font-size: 14px; font-weight: 600;
  cursor: pointer; user-select: none;
}
.filters-summary::-webkit-details-marker { display: none; }
.filters-summary:hover { background: rgba(0, 113, 227, 0.06); }
.filters[open] .filters-summary { background: var(--accent); color: #fff; }
.filters-body {
  margin-top: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.filter-group { min-width: 0; }
.filter-group + .filter-group { border-top: 1px solid var(--hairline); padding-top: var(--sp-4); }
.filter-title { font-size: 13px; font-weight: 700; margin-bottom: var(--sp-2); }

/* Kategorie — svislý seznam odkazů */
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-link {
  display: flex; align-items: center;
  min-height: 40px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-tile);
  font-size: 14px; font-weight: 500; color: var(--text);
  text-decoration: none;
}
.cat-link:hover { color: var(--accent); background: rgba(0, 113, 227, 0.06); text-decoration: none; }
.cat-link--active { background: var(--accent); color: #fff; font-weight: 600; }
.cat-link--active:hover { background: var(--accent); color: #fff; }

/* Typ zařízení — pill chips */
.device-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--bg);
  text-decoration: none;
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-active:hover { color: #fff; }

.filters-reset {
  align-self: flex-start;
  font-size: 13px; color: var(--text-muted);
  text-decoration: underline;
  padding: var(--sp-2) 0;
}
.filters-reset:hover { color: var(--accent); }

@media (min-width: 1100px) {
  .filters { margin-bottom: 0; }
  /* S JS je panel na desktopu vždy otevřený a tlačítko skryté;
     bez JS zůstává tlačítko viditelné a panel jde rozbalit kliknutím. */
  .js .filters-summary { display: none; }
  .js .filters-body { margin-top: 0; }
  .filters { position: sticky; top: calc(var(--header-h) + var(--sp-4)); }
}

/* ===== TOOLBAR ŘAZENÍ ===== */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.toolbar-count { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sort-box { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; flex-wrap: wrap; }
.sort-label { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.sort-link {
  display: inline-flex; align-items: center;
  height: 34px; padding: 0 var(--sp-4);
  border: 1px solid var(--hairline); border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--bg); text-decoration: none; white-space: nowrap;
}
.sort-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.sort-link--active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sort-link--active:hover { color: #fff; }

/* ===== GRID KATALOGU (design kit 1:1) ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 480px)  { .grid { gap: var(--sp-3); } }
@media (min-width: 768px)  { .grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* ===== PRODUKTOVÁ KARTA (design kit 1:1) ===== */
.card {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
/* FOTO z BAKR feedu na bílém → dlaždice čistě bílá, contain + padding */
.card-media {
  position: relative; display: block;
  background: #ffffff;
  aspect-ratio: 1 / 1;
  padding: var(--sp-3);
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.badge {
  position: absolute; top: var(--sp-2); left: var(--sp-2); z-index: 2;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  color: #fff;
}
.badge-sale { background: var(--sale); }
.badge-info { background: var(--accent); }
.badge + .badge { left: auto; right: var(--sp-2); }

.card-body {
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-1);
  flex: 1;
}
.card-cat { font-size: var(--fs-meta); color: var(--text-muted); }
.card-title {
  font-size: var(--fs-card-title); font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2 * 1.35em);
}
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-stock {
  font-size: var(--fs-meta); font-weight: 500; color: var(--success);
  display: flex; align-items: center; gap: 6px;
}
.card-stock .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
}
.card-price-row {
  display: flex; align-items: baseline; gap: var(--sp-2);
  margin-top: auto; padding-top: var(--sp-1);
}
.price { font-size: var(--fs-price); font-weight: 700; color: var(--text); }
.price-old { font-size: var(--fs-price-old); font-weight: 400; color: var(--text-muted); }

/* Formulář „Do košíku" nesmí rozbít flex sloupec karty */
.card-form { display: block; }
/* .btn.btn-card (vyšší specificita): texty tlačítek se nesmí zalamovat
   v úzkých kartách 2sloupcové mřížky */
.btn.btn-card { width: 100%; margin-top: var(--sp-2); padding: 0 var(--sp-3); white-space: nowrap; }
@media (max-width: 479px) {
  .btn.btn-card { font-size: 13px; }
}

/* ===== STAVY KARET ===== */
.card-stock--low { color: var(--success); }
.card--soldout .card-media img { opacity: .55; }
.card--soldout .card-stock { color: var(--text-muted); }

/* ===== TLAČÍTKA (design kit 1:1 — jen varianty užité na katalogu) ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 var(--sp-5);
  border-radius: var(--radius-pill);
  font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--hairline); }
.btn-secondary:hover { background: #ebebed; }

/* ===== STRÁNKOVÁNÍ ===== */
.pagination { margin-top: var(--sp-6); }
.pagination ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  gap: var(--sp-2); flex-wrap: wrap;
}
.page-link {
  min-width: 40px; height: 40px; padding: 0 var(--sp-3);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline); border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600; color: var(--text); background: var(--bg);
  font-variant-numeric: tabular-nums; text-decoration: none;
}
.page-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-link[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-link--disabled { color: var(--text-muted); pointer-events: none; }

/* ===== PRÁZDNÝ STAV ===== */
.empty-state {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
}
.empty-title { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.01em; }
.empty-text { color: var(--text-muted); margin: var(--sp-2) 0 var(--sp-4); }
