/*
 * Category and search pages (product/category.twig, product/search.twig, journal3/products.twig cards,
 * journal3/module/filter.twig). Added by journal3/event/category.php controller_product_category_before and by
 * product/search.php. Same look as cart.css / account.css.
 *
 * Styling only: everything Journal admin controls stays with the skin, so this file never sets `display`/`visibility`
 * on toggled elements (rating, description, stats, stepper, wishlist/compare, quickview, labels, sort/limit selects,
 * price tax, search page checkboxes/titles...), nor positions/hover behaviour of the card buttons, grid columns, title
 * position or description order. The skin CSS is printed inline after this file, so selectors start with the page id
 * (or html.route-* #filter for the filter, which Journal moves into an off-canvas panel on phones). :is() keeps the
 * specificity of a single id / class, so both pages resolve exactly like the category page did on its own.
 */

:is(#product-category, #product-search),
html:is(.route-product-category, .route-product-search) #filter,
html:is(.route-product-category, .route-product-search) .mobile-filter-container,
html:is(.route-product-category, .route-product-search) .mobile-filter-trigger {
  --cat-accent: #2563eb;
  --cat-accent-hover: #1d4ed8;
  --cat-accent-soft: #eff6ff;
  --cat-accent-ring: rgba(37, 99, 235, .18);
  --cat-text: #111827;
  --cat-text-soft: #374151;
  --cat-muted: #6b7280;
  --cat-border: #e5e7eb;
  --cat-border-strong: #d1d5db;
  --cat-surface: #fff;
  --cat-surface-soft: #f8fafc;
  --cat-danger: #dc2626;
  --cat-radius: 14px;
  --cat-radius-sm: 10px;
  --cat-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  --cat-shadow-hover: 0 14px 32px -14px rgba(15, 23, 42, .28);
}

/* ---------- Subcategories (refine) ---------- */

:is(#product-category, #product-search) #content .refine-categories {
  margin-bottom: 24px;
}

:is(#product-category, #product-search) #content .refine-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--cat-text);
}

:is(#product-category, #product-search) #content .refine-item a {
  height: 100%;
  border: 1px solid var(--cat-border);
  border-radius: var(--cat-radius-sm);
  background: var(--cat-surface);
  color: var(--cat-text-soft);
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, color .15s;
}

:is(#product-category, #product-search) #content .refine-item a {
  padding: 8px 8px 4px;
}

:is(#product-category, #product-search) #content .refine-item a img {
  border-radius: 8px;
}

:is(#product-category, #product-search) #content .refine-name {
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
}

.no-touchevents :is(#product-category, #product-search) #content .refine-item a:hover {
  border-color: var(--cat-accent);
  box-shadow: 0 0 0 3px var(--cat-accent-ring);
  color: var(--cat-accent);
}

/* "links" display: compact pills */
:is(#product-category, #product-search) #content .refine-links .refine-item a {
  padding: 0;
  border-radius: 999px;
}

:is(#product-category, #product-search) #content .refine-links .refine-name {
  padding: 7px 14px;
}

/* ---------- Toolbar: grid/list, compare, sort, limit ---------- */

:is(#product-category, #product-search) #content .products-filter {
  gap: 10px 16px;
  margin-bottom: 20px;
  padding: 8px;
  border: 1px solid var(--cat-border);
  border-radius: var(--cat-radius);
  background: var(--cat-surface);
  box-shadow: var(--cat-shadow);
}

:is(#product-category, #product-search) #content .products-filter .grid-list {
  display: flex;
  align-items: center;
  gap: 4px;
}

:is(#product-category, #product-search) #content .products-filter .view-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--cat-radius-sm);
  background: transparent;
  color: var(--cat-muted);
  transition: background-color .15s, color .15s;
}

.no-touchevents :is(#product-category, #product-search) #content .products-filter .view-btn:hover {
  background: var(--cat-surface-soft);
  color: var(--cat-text);
}

:is(#product-category, #product-search) #content .products-filter .view-btn.active {
  background: var(--cat-accent-soft);
  color: var(--cat-accent);
}

:is(#product-category, #product-search) #content .products-filter .view-btn::before {
  color: inherit;
}

:is(#product-category, #product-search) #content .products-filter .compare-btn {
  margin-inline-start: 6px;
  padding: 0 12px;
  height: 40px;
  line-height: 40px;
  border-radius: var(--cat-radius-sm);
  color: var(--cat-muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}

.no-touchevents :is(#product-category, #product-search) #content .products-filter .compare-btn:hover {
  background: var(--cat-surface-soft);
  color: var(--cat-text);
}

:is(#product-category, #product-search) #content .products-filter .select-group {
  gap: 8px;
}

:is(#product-category, #product-search) #content .products-filter .select-group .input-group {
  align-items: center;
  height: 40px;
  padding-inline-start: 12px;
  border: 1px solid var(--cat-border-strong);
  border-radius: var(--cat-radius-sm);
  background: var(--cat-surface);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}

:is(#product-category, #product-search) #content .products-filter .select-group .input-group:focus-within {
  border-color: var(--cat-accent);
  box-shadow: 0 0 0 3px var(--cat-accent-ring);
}

:is(#product-category, #product-search) #content .products-filter .select-group .input-group-addon {
  padding: 0 4px 0 0;
  border: 0;
  background: transparent;
  color: var(--cat-muted);
  font-size: 13px;
}

:is(#product-category, #product-search) #content .products-filter .select-group select.form-control {
  height: 38px;
  padding-top: 0;
  padding-bottom: 0;
  /* the skin styles every select.form-control with !important; the wrapper draws the border instead */
  border: 0 !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
  color: var(--cat-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* the skin hides the labels on phones: drop the left padding they needed */
@media (max-width: 600px) {
  :is(#product-category, #product-search) #content .products-filter {
    padding: 6px;
  }

  :is(#product-category, #product-search) #content .products-filter .select-group .input-group {
    padding-inline-start: 4px;
  }

  :is(#product-category, #product-search) #content .products-filter .compare-btn {
    margin-inline-start: 0;
    padding: 0 8px;
  }
}

/* ---------- Product cards (grid and list view) ---------- */

:is(#product-category, #product-search) .main-products .product-thumb {
  height: 100%;
  padding: 12px 12px 14px;
  border: 1px solid var(--cat-border);
  border-radius: var(--cat-radius);
  background: var(--cat-surface);
  box-shadow: var(--cat-shadow);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.no-touchevents :is(#product-category, #product-search) .main-products .product-thumb:hover {
  border-color: #c7d7fe;
  box-shadow: var(--cat-shadow-hover);
  transform: translateY(-2px);
}

:is(#product-category, #product-search) .main-products .product-thumb .image,
:is(#product-category, #product-search) .main-products .product-thumb .product-img,
:is(#product-category, #product-search) .main-products .product-thumb .product-img img {
  border-radius: var(--cat-radius-sm);
}

/* out of stock: fade the photo a little (the skin already dims the cart button) */
:is(#product-category, #product-search) .main-products .out-of-stock .product-thumb .product-img img {
  opacity: .72;
}

:is(#product-category, #product-search) .main-products .product-thumb .caption {
  padding-top: 4px;
}

:is(#product-category, #product-search) .main-products .product-thumb .name {
  margin-top: 10px;
  margin-bottom: 8px;
}

:is(#product-category, #product-search) .main-products .product-thumb .name a {
  color: var(--cat-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

/* keep prices on one line across a row when the skin clamps names to 2 lines */
:is(#product-category, #product-search) .main-products.product-grid .product-thumb .name a {
  min-height: calc(2 * 1.35em);
}

.no-touchevents :is(#product-category, #product-search) .main-products .product-thumb .name a:hover,
.no-touchevents :is(#product-category, #product-search) .main-products .product-thumb .image-group:hover + .caption .name a {
  color: var(--cat-accent);
  text-decoration: none;
}

:is(#product-category, #product-search) .main-products .product-thumb .description {
  color: var(--cat-muted);
}

:is(#product-category, #product-search) .main-products .product-thumb .price {
  margin-top: auto;
  margin-bottom: 2px;
  color: var(--cat-text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
}

:is(#product-category, #product-search) .main-products .product-thumb .price-new {
  color: var(--cat-danger);
}

:is(#product-category, #product-search) .main-products .product-thumb .price-old {
  color: var(--cat-muted);
  font-size: 13px;
  font-weight: 400;
}

:is(#product-category, #product-search) .main-products .product-thumb .price-tax {
  color: var(--cat-muted);
}

:is(#product-category, #product-search) .main-products .product-thumb .stats {
  color: var(--cat-muted);
}

/* card buttons and labels keep the skin's colours, shapes and hover/static placement; only round the button bar to match the card */
:is(#product-category, #product-search) .main-products .product-thumb .button-group {
  border-radius: var(--cat-radius-sm);
  overflow: hidden;
}

/* list view: cards replace the skin's divider lines */
:is(#product-category, #product-search) .main-products.product-list .product-layout + .product-layout {
  margin-top: 16px;
  padding-top: 0;
  border-top: 0;
}

:is(#product-category, #product-search) .main-products.product-list .product-thumb {
  padding: 16px;
}

:is(#product-category, #product-search) .main-products.product-list .product-thumb .name {
  margin-top: 0;
}

/* list view puts the cart button inline as a text link */
:is(#product-category, #product-search) .main-products.product-list .product-thumb .button-group {
  overflow: visible;
}

@media (max-width: 500px) {
  :is(#product-category, #product-search) .main-products .product-thumb {
    padding: 8px 8px 10px;
  }

  :is(#product-category, #product-search) .main-products .product-thumb .name a {
    font-size: 14px;
  }

  :is(#product-category, #product-search) .main-products .product-thumb .price {
    font-size: 16px;
  }
}

/* ---------- Pagination ---------- */

:is(#product-category, #product-search) #content .pagination-results {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--cat-border);
  color: var(--cat-muted);
  font-size: 14px;
}

:is(#product-category, #product-search) #content ul.pagination {
  --pagination-gap: 6px;
}

:is(#product-category, #product-search) #content ul.pagination > li::before {
  display: none;
}

:is(#product-category, #product-search) #content ul.pagination > li > a,
:is(#product-category, #product-search) #content ul.pagination > li > span {
  width: 40px;
  height: 40px;
  border: 1px solid var(--cat-border) !important;
  border-radius: var(--cat-radius-sm) !important;
  background: var(--cat-surface);
  box-shadow: none;
  color: var(--cat-text-soft);
  font-size: 14px;
  font-weight: 600;
  transition: border-color .15s, background-color .15s, color .15s;
}

.no-touchevents :is(#product-category, #product-search) #content ul.pagination > li > a:hover {
  border-color: var(--cat-accent) !important;
  background: var(--cat-accent-soft);
  color: var(--cat-accent);
}

:is(#product-category, #product-search) #content ul.pagination > li.active > a,
:is(#product-category, #product-search) #content ul.pagination > li.active > span {
  border-color: var(--cat-accent) !important;
  background: var(--cat-accent);
  color: #fff;
}

:is(#product-category, #product-search) #content ul.pagination > li > a::before {
  color: inherit;
}

/* ---------- Category description (position/visibility set in Journal admin) ---------- */

:is(#product-category, #product-search) #content .category-description {
  margin-top: 32px;
  padding: 28px 32px;
  border: 1px solid var(--cat-border);
  border-radius: var(--cat-radius);
  background: var(--cat-surface);
  box-shadow: var(--cat-shadow);
  color: var(--cat-text-soft);
}

:is(#product-category, #product-search) #content .category-description > .category-image {
  float: left;
  max-width: min(240px, 40%);
  height: auto;
  margin: 0 28px 16px 0;
  border-radius: var(--cat-radius-sm);
}

:is(#product-category, #product-search) #content .category-text {
  font-size: 15px;
  line-height: 1.65;
}

:is(#product-category, #product-search) #content .category-text p {
  margin: 0 0 12px;
}

:is(#product-category, #product-search) #content .category-text p:empty {
  margin: 0;
}

:is(#product-category, #product-search) #content .category-text :is(h1, h2, h3, h4) {
  margin: 20px 0 10px;
  color: var(--cat-text);
  font-weight: 700;
  line-height: 1.3;
}

:is(#product-category, #product-search) #content .category-text :is(h1, h2) { font-size: 20px; }
:is(#product-category, #product-search) #content .category-text :is(h3, h4) { font-size: 17px; }

:is(#product-category, #product-search) #content .category-text strong,
:is(#product-category, #product-search) #content .category-text b {
  color: var(--cat-text);
}

/* lists sit beside the floated category image instead of their bullets running under it */
:is(#product-category, #product-search) #content .category-text :is(ul, ol) {
  display: flow-root;
  margin: 0 0 14px;
  padding-inline-start: 1.3em;
}

:is(#product-category, #product-search) #content .category-text li {
  margin: 4px 0;
  padding-inline-start: 2px;
}

:is(#product-category, #product-search) #content .category-text li::marker {
  color: var(--cat-accent);
}

:is(#product-category, #product-search) #content .category-text a {
  color: var(--cat-accent);
}

/* image-only description (no text): just the picture, no empty card around it */
:is(#product-category, #product-search) #content .category-description:not(:has(.category-text)) {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

@media (max-width: 767px) {
  :is(#product-category, #product-search) #content .category-description {
    padding: 20px;
  }

  :is(#product-category, #product-search) #content .category-description > .category-image {
    float: none;
    max-width: 100%;
    margin: 0 auto 16px;
  }
}

/* empty category */
:is(#product-category, #product-search) #content .main-products-wrapper > p:only-of-type {
  padding: 32px;
  border: 1px dashed var(--cat-border-strong);
  border-radius: var(--cat-radius);
  background: var(--cat-surface-soft);
  color: var(--cat-muted);
  text-align: center;
}

/* ---------- Search page: criteria form and category chips ---------- */

/* the search button sits beside the keyword/category row instead of on its own line below the form */
#product-search #content .search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0 12px;
  margin-bottom: 28px;
  padding: 16px;
  border: 1px solid var(--cat-border);
  border-radius: var(--cat-radius);
  background: var(--cat-surface);
  box-shadow: var(--cat-shadow);
}

#product-search #content .search-panel .search-form .form-control {
  height: 44px;
  border-radius: var(--cat-radius-sm);
}

#product-search #content .search-panel .search-form label {
  color: var(--cat-text-soft);
}

#product-search #content .search-panel .search-form input[type="checkbox"] {
  accent-color: var(--cat-accent);
}

/* the admin "buttons margin" is meant for the page's bottom buttons, not for one placed next to the inputs */
#product-search #content .search-panel > .buttons {
  margin: 0 !important;
  padding: 0;
  border: 0;
  background: none;
}

#product-search #content .search-panel > .buttons .pull-right {
  float: none;
}

#product-search #content .search-panel #button-search {
  height: 44px;
  padding: 0 24px;
  border-radius: var(--cat-radius-sm);
}

@media (max-width: 600px) {
  #product-search #content .search-panel {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  #product-search #content .search-panel > .buttons {
    margin-top: 10px !important;
  }

  #product-search #content .search-panel #button-search {
    width: 100%;
  }
}

#product-search #content .search-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

#product-search #content .search-category {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--cat-border);
  border-radius: 999px;
  background: var(--cat-surface);
  color: var(--cat-text-soft);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s, background-color .15s, color .15s;
}

.no-touchevents #product-search #content .search-category:hover {
  border-color: var(--cat-accent);
  color: var(--cat-accent);
}

#product-search #content .search-category.active {
  border-color: var(--cat-accent);
  background: var(--cat-accent-soft);
  color: var(--cat-accent);
}

#product-search #content .search-category-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--cat-muted);
  font-size: 12px;
  text-align: center;
}

#product-search #content .search-category.active .search-category-count {
  background: var(--cat-surface);
  color: var(--cat-accent);
}

/* phones: one swipeable row instead of several lines of chips above the products */
@media (max-width: 600px) {
  #product-search #content .search-categories {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  #product-search #content .search-categories::-webkit-scrollbar {
    display: none;
  }

  #product-search #content .search-category {
    flex: 0 0 auto;
  }
}

/* ---------- Filter module (sidebar on desktop, off-canvas on phones) ---------- */

html:is(.route-product-category, .route-product-search) #filter .module-title {
  gap: 8px;
}

html:is(.route-product-category, .route-product-search) #filter .filter-title-text {
  color: var(--cat-text);
  font-size: 17px;
  font-weight: 700;
}

html:is(.route-product-category, .route-product-search) #filter .reset-filter.btn,
html:is(.route-product-category, .route-product-search) .mobile-filter-container .reset-filter.btn {
  padding: 6px 12px !important;
  border: 1px solid var(--cat-border-strong) !important;
  border-radius: 999px !important;
  background: var(--cat-surface) !important;
  color: var(--cat-text-soft) !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
  transition: border-color .15s, color .15s;
}

html.no-touchevents:is(.route-product-category, .route-product-search) #filter .reset-filter.btn:hover,
html.no-touchevents:is(.route-product-category, .route-product-search) .mobile-filter-container .reset-filter.btn:hover {
  border-color: var(--cat-danger) !important;
  color: var(--cat-danger) !important;
}

html:is(.route-product-category, .route-product-search) #filter .reset-filter.btn::before,
html:is(.route-product-category, .route-product-search) .mobile-filter-container .reset-filter.btn::before {
  color: inherit !important;
}

html:is(.route-product-category, .route-product-search) #filter .panel-heading a {
  color: var(--cat-text);
  font-size: 15px;
  font-weight: 600;
}

html.no-touchevents:is(.route-product-category, .route-product-search) #filter .panel-heading:hover a,
html:is(.route-product-category, .route-product-search) #filter .panel-active .panel-heading a {
  color: var(--cat-accent);
}

html:is(.route-product-category, .route-product-search) #filter .panel-body > div > label {
  padding: 3px 4px;
  border-radius: 8px;
  color: var(--cat-text-soft);
  transition: background-color .12s, color .12s;
}

html.no-touchevents:is(.route-product-category, .route-product-search) #filter .panel-body > div > label:hover {
  background: var(--cat-surface-soft);
  color: var(--cat-text);
}

html:is(.route-product-category, .route-product-search) #filter .panel-body > div > label input[type="checkbox"],
html:is(.route-product-category, .route-product-search) #filter .panel-body > div > label input[type="radio"] {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: var(--cat-accent);
  cursor: pointer;
}

html:is(.route-product-category, .route-product-search) #filter .panel-body > div > label input:checked ~ .links-text {
  color: var(--cat-text);
  font-weight: 600;
}

html:is(.route-product-category, .route-product-search) #filter .count-badge {
  min-width: 26px;
  height: 20px;
  padding: 0 7px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--cat-muted);
  font-size: 11.5px;
  font-weight: 600;
}

html:is(.route-product-category, .route-product-search) #filter .panel-body > div > label input:checked ~ .count-badge {
  background: var(--cat-accent-soft);
  color: var(--cat-accent);
}

/* price range */
html:is(.route-product-category, .route-product-search) #filter .irs-line {
  background-color: var(--cat-border);
}

html:is(.route-product-category, .route-product-search) #filter .irs-bar {
  background-color: var(--cat-accent);
}

html:is(.route-product-category, .route-product-search) #filter .irs-slider {
  width: 18px;
  height: 18px;
  border: 3px solid var(--cat-surface);
  background-color: var(--cat-accent);
  box-shadow: 0 0 0 1px var(--cat-accent), 0 2px 6px rgba(15, 23, 42, .2);
}

html:is(.route-product-category, .route-product-search) #filter .extra-controls {
  gap: 6px;
}

html:is(.route-product-category, .route-product-search) #filter .extra-controls input {
  height: 40px;
  border-color: var(--cat-border-strong) !important;
  border-radius: var(--cat-radius-sm) !important;
  color: var(--cat-text) !important;
  font-weight: 600;
}

html:is(.route-product-category, .route-product-search) #filter .extra-controls input:focus {
  border-color: var(--cat-accent) !important;
  box-shadow: 0 0 0 3px var(--cat-accent-ring);
}

html:is(.route-product-category, .route-product-search) #filter .currency-symbol {
  color: var(--cat-muted);
}

/* phones: floating "filter" button that opens the off-canvas panel */
html:is(.route-product-category, .route-product-search) .btn.mobile-filter-trigger {
  border: 0 !important;
  border-radius: 999px !important;
  background: var(--cat-accent) !important;
  box-shadow: 0 10px 24px -8px rgba(37, 99, 235, .55);
  color: #fff !important;
  font-weight: 600;
}

html.no-touchevents:is(.route-product-category, .route-product-search) .btn.mobile-filter-trigger:hover {
  background: var(--cat-accent-hover) !important;
}

html:is(.route-product-category, .route-product-search) .btn.mobile-filter-trigger::before {
  color: inherit;
}
