/* ═══════════════════════════════════════════════════════════
   CATALOG PAGE — concept leaseweb.comanda.dev/technica/v1
   ═══════════════════════════════════════════════════════════ */

/* ── Page wrapper ─────────────────────────────────────── */
.cat-page { background: #F5F7FA; min-height: 80vh; }

/* ── Breadcrumb ───────────────────────────────────────── */
.cat-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 0;
  font-size: 13px;
  color: #94a3b8;
}
.cat-breadcrumb a { color: #64748b; font-weight: 500; transition: color .2s; }
.cat-breadcrumb a:hover { color: #0284c7; }
.cat-breadcrumb i { font-size: 9px; }
.cat-breadcrumb span { color: #1d1d1f; font-weight: 600; }

/* ── Layout ───────────────────────────────────────────── */
.cat-layout {
  display: grid;
  grid-template-columns: 268px 1fr;
  gap: 24px;
  align-items: start;
  padding-bottom: 60px;
}
/* Друга колонка grid — ОБОВ'ЯЗКОВО min-width:0 щоб не виходити за межі */
.cat-main {
  min-width: 0;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — Premium glassmorphism style
   ═══════════════════════════════════════════════════════════ */
.cat-sidebar {
  background: #ffffff;
  border-radius: 24px;
  padding: 0;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 10px 40px rgba(15,23,42,.06);
  border: 1px solid rgba(15,23,42,.06);
}
/* Thin scrollbar for sidebar */
.cat-sidebar::-webkit-scrollbar { width: 4px; }
.cat-sidebar::-webkit-scrollbar-track { background: transparent; }
.cat-sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }
.cat-sidebar::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* Sidebar header — "Фільтри" title */
.sf-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #f1f5f9;
}
.sf-sidebar-title {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sf-sidebar-title i {
  font-size: 14px;
  color: #0284c7;
  background: #f0f9ff;
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.sidebar-header-mobile {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 700;
  font-size: 16px;
  font-family: 'Outfit', sans-serif;
}
#closeSidebar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #f1f5f9; border: none; cursor: pointer;
  display: grid; place-items: center; font-size: 14px; color: #64748b;
}

/* ── Filter section ─────────────────────────────────────── */
.sf-section {
  border-bottom: 1px solid rgba(15,23,42,.05);
  padding: 0;
}
.sf-section:last-of-type { border-bottom: none; }

.sf-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 20px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .8px;
  cursor: pointer;
  user-select: none;
  transition: color .2s, background .2s;
}
.sf-title:hover { color: #0284c7; background: #fafcff; }
.sf-title:hover .sf-chevron { color: #0284c7; background: #e0f2fe; }

.sf-chevron {
  font-size: 9px;
  color: #cbd5e1;
  transition: transform .3s cubic-bezier(.16,1,.3,1), color .2s;
  background: #f1f5f9;
  width: 20px; height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sf-chevron--open { transform: rotate(180deg); }

.sf-body {
  padding: 0 16px 14px;
  overflow: hidden;
  max-height: 2000px;
  transition: max-height .35s cubic-bezier(.16,1,.3,1), padding .3s ease;
}
/* CRITICAL: display:none breaks form — use max-height:0 */
.sf-body.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* ── Price range ─────────────────────────────────────────── */
.price-range-wrap { padding-top: 6px; }

.price-track {
  position: relative;
  height: 4px;
  background: #e2e8f0;
  border-radius: 4px;
  margin: 20px 0 16px;
}
.price-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 4px;
  pointer-events: none;
}
.price-slider {
  position: absolute;
  width: 100%;
  height: 4px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  top: 0; left: 0;
}
.price-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid #0284c7;
  box-shadow: 0 4px 12px rgba(2,132,199,.25);
  cursor: pointer;
  pointer-events: auto;
  transition: transform .2s, box-shadow .2s;
}
.price-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 6px 20px rgba(2,132,199,.35);
}

.price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.price-inputs span { font-size: 12px; color: #cbd5e1; font-weight: 600; }
.price-input {
  flex: 1;
  height: 38px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: #0f172a;
  font-weight: 600;
  outline: none;
  transition: border .2s, box-shadow .2s;
  text-align: center;
  width: 0;
  background: #f8fafc;
}
.price-input:focus {
  border-color: #0284c7;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(2,132,199,.1);
}
.price-apply-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  padding: 9px 0;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .25s;
}
.price-apply-btn:hover,
.price-apply-btn--active {
  background: #0284c7;
  border-color: #0284c7;
  color: #fff;
  box-shadow: 0 4px 12px rgba(2,132,199,.25);
}

/* ── Checkboxes — premium stefservice pattern ────────────── */
.sf-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  font-weight: 500;
  transition: color .15s, background .15s;
  border-radius: 8px;
  margin: 1px -8px;
}
.sf-check:hover { color: #0284c7; background: rgba(2,132,199,.05); }
.sf-check--active { color: #0284c7; font-weight: 600; }

/* Wrapper — position:relative для input absolute inset:0 */
.sf-checkmark-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}
/* input opacity:0 поверх — завжди в DOM, завжди відправляється */
.sf-input-hidden {
  opacity: 0;
  position: absolute;
  inset: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  margin: 0;
  z-index: 2;
}

/* Кастомний вигляд чекбоксу */
.sf-checkmark {
  width: 18px; height: 18px;
  border: 1.5px solid #cbd5e1;
  border-radius: 5px;
  position: relative;
  transition: all .2s cubic-bezier(.34,1.56,.64,1);
  background: #fff;
  z-index: 1;
  pointer-events: none;
}
.sf-check:hover .sf-checkmark {
  border-color: #93c5fd;
  background: #f0f9ff;
}
.sf-input-hidden:checked ~ .sf-checkmark {
  background: #0284c7;
  border-color: #0284c7;
  box-shadow: 0 4px 10px rgba(2,132,199,.25);
  transform: scale(1.05);
}
.sf-input-hidden:checked ~ .sf-checkmark::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 6px; height: 10px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

.sf-label { font-weight: 500; line-height: 1.3; }
.sf-label--active { color: #0284c7; font-weight: 600; }
.sf-count {
  color: #cbd5e1;
  font-size: 11px;
  margin-left: 2px;
  font-weight: 400;
}

/* Fallback JS-checked state */
.sf-checkmark.checked {
  background: #0284c7;
  border-color: #0284c7;
  box-shadow: 0 4px 10px rgba(2,132,199,.25);
}
.sf-checkmark.checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 6px; height: 10px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

.active-filters:empty { display: none; }

/* ═══════════════════════════════════════════════════════════
   MAIN COLUMN
   ═══════════════════════════════════════════════════════════ */

/* Category header */
.cat-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.cat-title {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: #1d1d1f;
  letter-spacing: -.5px;
}
.cat-count {
  font-size: 14px;
  color: #94a3b8;
  font-weight: 500;
}

/* Subcategory chips */
.subcats-scroll {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.subcat-chip {
  padding: 7px 16px;
  border-radius: 100px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  transition: all .25s ease;
  white-space: nowrap;
}
.subcat-chip:hover, .subcat-chip.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #fff;
}

/* Toolbar */
.cat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 14px;
  margin-bottom: 20px;
  border: 1px solid rgba(15,23,42,.06);
  box-shadow: 0 2px 8px rgba(15,23,42,.03);
}
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.af-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  color: #0284c7;
}
.af-remove {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #bae6fd;
  color: #0284c7;
  display: grid;
  place-items: center;
  font-size: 9px;
  transition: all .2s;
}
.af-remove:hover { background: #ef4444; color: #fff; }

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.btn-mobile-filter {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f1f5f9;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.btn-mobile-filter:hover { background: #e2e8f0; }

.sort-select {
  height: 38px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 0 32px 0 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: #475569;
  outline: none;
  cursor: pointer;
  transition: border .2s;
  appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center #fff;
}
.sort-select:focus { border-color: #0284c7; }

.view-switcher { display: flex; gap: 4px; }
.vs-btn {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .2s;
}
.vs-btn.active, .vs-btn:hover {
  background: #0284c7;
  border-color: #0284c7;
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════
   PRODUCT CARDS
   ═══════════════════════════════════════════════════════════ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.cat-card {
  background: #fff;
  border-radius: 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all .3s cubic-bezier(.16,1,.3,1);
  border: 1px solid rgba(15,23,42,.05);
  overflow: hidden;
}
.cat-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(15,23,42,.1);
  border-color: transparent;
}

/* Badges */
.cc-badges {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 3;
}
.cc-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: #fff;
}
.cc-badge--hit  { background: #f59e0b; }
.cc-badge--sale { background: #ef4444; }
.cc-badge--new  { background: #0284c7; }

/* Actions */
.cc-actions {
  position: absolute;
  top: 10px; right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
  opacity: 0;
  transform: translateX(8px);
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
}
.cat-card:hover .cc-actions { opacity: 1; transform: translateX(0); }
.cc-act-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0,0,0,.06);
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .2s;
}
.cc-act-btn:hover { background: #0284c7; color: #fff; border-color: #0284c7; }

/* Image */
.cc-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  background: #f8fafc;
  border-radius: 0;
  overflow: hidden;
  position: relative;
}
.cc-img {
  max-height: 150px;
  max-width: 85%;
  object-fit: contain;
  transition: transform .5s cubic-bezier(.34,1.56,.64,1);
}
.cat-card:hover .cc-img { transform: scale(1.07) translateY(-4px); }
.cc-placeholder-icon {
  font-size: 80px;
  color: #cbd5e1;
  transition: transform .5s cubic-bezier(.34,1.56,.64,1);
}
.cat-card:hover .cc-placeholder-icon { transform: scale(1.1) translateY(-4px); color: #94a3b8; }

/* Info */
.cc-info { padding: 14px 16px 16px; display: flex; flex-direction: column; flex-grow: 1; }

.cc-brand {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 6px;
}
.cc-name {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .2s;
}
.cc-name:hover { color: #0284c7; }

/* Stock status */
.cc-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.cc-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cc-status--ok   .cc-dot { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
.cc-status--ok   { color: #10b981; }
.cc-status--low  .cc-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.cc-status--low  { color: #f59e0b; }
.cc-status--out  .cc-dot { background: #94a3b8; }
.cc-status--out  { color: #94a3b8; }

/* Footer */
.cc-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: auto;
  gap: 8px;
}
.cc-price-old {
  font-size: 12px;
  color: #94a3b8;
  text-decoration: line-through;
  font-weight: 500;
  margin-bottom: 2px;
}
.cc-price {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #1d1d1f;
  letter-spacing: -.5px;
  line-height: 1;
}
.cc-price--sale { color: #ef4444; }

.cc-cart-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: none;
  background: #f1f5f9;
  color: #475569;
  font-size: 17px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  flex-shrink: 0;
}
.cat-card:hover .cc-cart-btn {
  background: #0284c7;
  color: #fff;
  box-shadow: 0 8px 20px rgba(2,132,199,.3);
}
.cc-cart-btn:hover { transform: scale(1.1) rotate(5deg); }

/* ── LIST VIEW ───────────────────────────── */
.cat-list { grid-template-columns: 1fr; gap: 12px; }
.cat-list .cat-card { flex-direction: row; }
.cat-list .cc-img-wrap { width: 180px; height: 140px; flex-shrink: 0; border-radius: 0; }
.cat-list .cc-info { flex-direction: row; align-items: center; gap: 20px; padding: 16px 20px; }
.cat-list .cc-brand { margin-bottom: 0; }
.cat-list .cc-name { -webkit-line-clamp: 1; margin-bottom: 0; flex: 1; }
.cat-list .cc-status { margin-bottom: 0; }
.cat-list .cc-footer { flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }

/* ── EMPTY STATE ─────────────────────────── */
.cat-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
}
.cat-empty i { font-size: 56px; color: #e2e8f0; margin-bottom: 20px; display: block; }
.cat-empty h3 { font-size: 22px; font-weight: 800; font-family: 'Outfit', sans-serif; margin-bottom: 10px; }
.cat-empty p  { color: #94a3b8; font-size: 15px; }

/* ═══════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════ */
.cat-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 32px 0 16px;
}
.pg-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  display: grid;
  place-items: center;
  transition: all .25s ease;
  cursor: pointer;
  text-decoration: none;
}
.pg-btn:hover { background: #0284c7; border-color: #0284c7; color: #fff; transform: translateY(-2px); }
.pg-btn--active { background: #0284c7; border-color: #0284c7; color: #fff; box-shadow: 0 4px 12px rgba(2,132,199,.3); }
.pg-btn--disabled { opacity: .4; cursor: default; pointer-events: none; }
.pg-dots { color: #94a3b8; font-size: 16px; padding: 0 4px; }

/* ═══════════════════════════════════════════════════════════
   MOBILE OVERLAY
   ═══════════════════════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 998;
}
.sidebar-overlay.show { display: block; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .cat-layout { grid-template-columns: 1fr; }

  .cat-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 300px;
    z-index: 999;
    border-radius: 0 20px 20px 0;
    overflow-y: auto;
    transform: translateX(-110%);
    transition: transform .4s cubic-bezier(.16,1,.3,1);
  }
  .cat-sidebar.open { transform: translateX(0); }
  .sidebar-header-mobile { display: flex; }

  .btn-mobile-filter { display: flex; }
  .view-switcher { display: none; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-title { font-size: 22px; }
}

@media (max-width: 540px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cc-img-wrap { height: 150px; }
  .cc-img { max-height: 110px; }
  .cc-info { padding: 10px 12px 12px; }
  .cc-price { font-size: 18px; }
  .cc-name { font-size: 12px; }
  .cat-toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .toolbar-right { width: 100%; justify-content: space-between; }
}
