body { background: #f4f5f7; }

.page-wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px 60px; }

.breadcrumbs { padding: 16px 0 12px; font-size: 13px; color: #bbb; }
.breadcrumbs a { color: #bbb; text-decoration: none; transition: color .15s; }
.breadcrumbs a:hover { color: #2d9e00; }
.breadcrumbs span { margin: 0 6px; }

.cat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.cat-header h1 { font-size: 26px; font-weight: 800; color: #111; }
.cat-header-count {
  font-size: 12px; color: #2d9e00; font-weight: 700;
  background: #edf8e5; padding: 3px 10px; border-radius: 20px;
  margin-left: 10px; vertical-align: middle;
}

.sort-row { display: flex; align-items: center; gap: 10px; }
.sort-label { font-size: 13px; color: #999; white-space: nowrap; }
.sort-select { padding: 8px 14px; border: 1.5px solid #e8e8e8; border-radius: 10px; font-size: 13px; font-weight: 600; color: #333; background: #fff; cursor: pointer; outline: none; transition: border-color .15s; }
.sort-select:focus { border-color: #2d9e00; }
.sort-row .cs-trigger { font-weight: 600; }

.catalog-layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }

.filters-sidebar { background: #fff; border: none; border-radius: 16px; padding: 20px; position: sticky; top: 80px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.filters-title { font-size: 14px; font-weight: 800; color: #111; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.filters-reset { font-size: 12px; color: #2d9e00; text-decoration: none; font-weight: 600; }
.filters-reset:hover { text-decoration: underline; }

.filter-group { margin-bottom: 20px; }
.filter-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #bbb; margin-bottom: 10px; }

.currency-segment { display: flex; background: #f0f0f0; border-radius: 8px; padding: 3px; gap: 2px; margin-bottom: 10px; }
.cs-opt { flex: 1; padding: 6px 0; font-size: 12px; font-weight: 600; border: none; border-radius: 6px; background: transparent; color: #999; cursor: pointer; transition: all .18s; letter-spacing: .02em; }
.cs-opt:hover:not(.cs-active) { color: #555; }
.cs-active { background: #fff; color: #1a1a1a; box-shadow: 0 1px 4px rgba(0,0,0,.12); }

.filter-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-range input { width: 100%; padding: 8px 10px; border: 1.5px solid #e8e8e8; border-radius: 10px; font-size: 13px; outline: none; transition: border-color .15s; }
.filter-range input:focus { border-color: #2d9e00; }
.filter-range input::placeholder { color: #ccc; }

.filter-select { width: 100%; padding: 8px 12px; border: 1.5px solid #e8e8e8; border-radius: 10px; font-size: 13px; outline: none; background: #fff; cursor: pointer; transition: border-color .15s; }
.filter-select:focus { border-color: #2d9e00; }

/* ── Custom brand select ── */
.cs-wrap { position: relative; width: 100%; }
.cs-trigger {
  width: 100%; padding: 8px 12px;
  border: 1px solid #e0e0e0; border-radius: 8px;
  font-size: 13px; background: #fff; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  user-select: none; color: #333; transition: border-color .15s;
}
.cs-trigger:hover { border-color: #2d9e00; }
.cs-trigger.open { border-color: #2d9e00; border-radius: 8px 8px 0 0; }
.cs-arrow { font-size: 10px; color: #aaa; transition: transform .2s; flex-shrink: 0; margin-left: 6px; }
.cs-trigger.open .cs-arrow { transform: rotate(180deg); }
.cs-list {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff;
  border: 1px solid #2d9e00; border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 210px; /* 7 items */
  overflow-y: auto; z-index: 400; display: none;
  box-shadow: 0 6px 16px rgba(0,0,0,.1);
  -webkit-overflow-scrolling: touch;
}
.cs-list.open { display: block; }
.cs-item {
  padding: 9px 12px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid #f5f5f5; color: #333;
  transition: background .1s, color .1s;
}
.cs-item:last-child { border-bottom: none; }
.cs-item:hover { background: #f7fcf4; color: #2d9e00; }
.cs-item.selected { color: #2d9e00; font-weight: 700; background: #f7fcf4; }

.filter-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #444; cursor: pointer; }
.filter-checkbox input { width: 16px; height: 16px; accent-color: #2d9e00; cursor: pointer; }
.filter-count { margin-left: auto; font-size: 11px; color: #aaa; font-weight: 600; background: #f0f0f0; border-radius: 20px; padding: 1px 7px; }

.btn-apply { width: 100%; background: #2d9e00; color: #fff; border: none; padding: 12px; border-radius: 50px; font-size: 14px; font-weight: 700; cursor: pointer; margin-top: 8px; transition: background .15s, box-shadow .15s; box-shadow: 0 4px 12px rgba(45,158,0,.25); }
.btn-apply:hover { background: #259000; box-shadow: 0 6px 18px rgba(45,158,0,.35); }

.brand-list { display: flex; flex-direction: column; gap: 6px; }
.brand-item { display: flex !important; }
.brand-hidden, .color-hidden, .size-hidden { display: none !important; }
.brand-show-more { width: 100%; margin-top: 8px; background: none; border: 1px solid #e0e0e0; border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 600; color: #2d9e00; cursor: pointer; text-align: center; transition: background .15s, border-color .15s; }
.brand-show-more:hover { background: #f4fbf0; border-color: #2d9e00; }

/* ── Parts subcategory filter ── */
.subcat-list { display: flex; flex-direction: column; gap: 2px; }
.subcat-group { display: flex; flex-direction: column; }
.subcat-parent {
  display: block; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 700; color: #333;
  cursor: pointer; transition: background .12s, color .12s;
  user-select: none;
}
.subcat-parent:hover { background: #f4fbf0; color: #2d9e00; }
.subcat-parent.active { background: #edf8e5; color: #2d9e00; }
.subcat-children {
  display: none; flex-direction: column; gap: 1px;
  padding-left: 12px; margin-bottom: 2px;
}
.subcat-children.open { display: flex; }
.subcat-child {
  display: block; padding: 6px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 500; color: #666;
  cursor: pointer; transition: background .12s, color .12s;
  user-select: none; border-left: 2px solid #f0f0f0;
}
.subcat-child:hover { background: #f4fbf0; color: #2d9e00; border-left-color: #2d9e00; }
.subcat-child.active { background: #edf8e5; color: #2d9e00; font-weight: 700; border-left-color: #2d9e00; }

.catalog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.empty-state { grid-column: 1 / -1; text-align: center; padding: 60px 0; color: #bbb; }
.empty-state p { font-size: 16px; margin-top: 12px; }

.filter-toggle { display: none; }
.filters-close { display: none; }

@media (max-width: 1100px) { .catalog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1024px) { .catalog-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Filter overlay (mobile backdrop) ── */
.filter-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
}
.filter-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1024px) {
  .filter-overlay { display: block; }

  /* Layout */
  .catalog-layout { grid-template-columns: 1fr; }

  /* Filters drawer — slides in from left */
  .filters-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: min(300px, 82vw);
    height: 100%;
    z-index: 301;
    border-radius: 0;
    border: none;
    border-right: 1px solid #e8e8e8;
    box-shadow: 4px 0 24px rgba(0,0,0,.15);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .28s ease;
    padding: 20px 20px 32px;
    -webkit-overflow-scrolling: touch;
  }
  .filters-sidebar.open {
    transform: translateX(0);
  }

  /* Close button inside drawer */
  .filters-title { padding-bottom: 14px; margin-bottom: 18px; }
  .filters-close {
    display: block;
    background: none; border: none;
    font-size: 20px; color: #888;
    cursor: pointer; line-height: 1;
    padding: 0; margin-left: auto;
  }
  .filters-close:hover { color: #2d9e00; }

  /* Hide reset on mobile */
  .filters-reset { display: none; }

  /* Header: title on top, toolbar below */
  .cat-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
  .cat-header h1 { font-size: 20px; }
  .cat-header-count { font-size: 13px; }

  /* Toolbar: filter toggle + sort in one row */
  .sort-row { width: 100%; display: flex; align-items: center; gap: 8px; }
  .sort-label { display: none; }

  /* Filter toggle button */
  .filter-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    background: #fff;
    cursor: pointer;
    color: #333;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: border-color .15s, color .15s, background .15s;
  }
  .filter-toggle:hover { border-color: #2d9e00; color: #2d9e00; }
  .filter-toggle.active { background: #2d9e00; border-color: #2d9e00; color: #fff; }

  /* Sort select — same style as filter toggle */
  .sort-select {
    margin-left: auto;
    height: 36px;
    padding: 0 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    background: #fff;
    color: #333;
    cursor: pointer;
    box-sizing: border-box;
    appearance: auto;
    font-family: inherit;
  }
  .sort-select:focus { border-color: #2d9e00; outline: none; }
}

/* ── Subcategory tabs (equipment / parts pages) ── */
.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}
.cat-tab {
  display: inline-flex;
  align-items: center;
  padding: 7px 18px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  background: #f0f1f3;
  border: 2px solid transparent;
  text-decoration: none;
  transition: all .15s;
}
.cat-tab:hover  { background: #e6f5dc; color: #2d9e00; }
.cat-tab.active { background: #2d9e00; color: #fff; border-color: #2d9e00; }

@media (max-width: 600px) { .catalog-grid { grid-template-columns: 1fr; } }

@media (max-width: 480px) {
  .page-wrap { padding: 0 14px 40px; }
  .filter-toggle { padding: 10px 14px; font-size: 13px; }
  .filter-group-label { font-size: 10px; }
  .btn-apply { padding: 12px; font-size: 14px; }
}
