/* Shared catalogue surfaces; product data and existing view-mode logic stay intact. */
:root {
  --dh-catalog-panel: #f5f6f5;
  --dh-catalog-link: #884300;
  --dh-catalog-hover: #fff1e2;
  --dh-catalog-input-border: #7d827e;
  --dh-catalog-secondary: #5d625c;
}
html[data-theme="dark"] {
  --dh-catalog-panel: #292c2f;
  --dh-catalog-link: #ffbb78;
  --dh-catalog-hover: #41352a;
  --dh-catalog-input-border: #858c87;
  --dh-catalog-secondary: #babeb5;
}
#main:has(#catalogColumn) > h1 { color: var(--dh-text) !important; }
#catalogColumn :is(#nextSection, #smartFilter, #catalogLine),
#catalog :is(.catalogBannerForm, .catalogBannerFormContainer) {
  background-color: var(--dh-card) !important;
  border-color: var(--dh-border) !important;
  border-radius: 8px;
  color: var(--dh-text);
}
#nextSection .title, #smartFilter > .heading {
  background: var(--dh-catalog-panel) !important;
  color: var(--dh-text) !important;
  border-radius: 8px 8px 0 0;
}
#nextSection :is(li, ul), #smartFilter .paramsBox {
  border-color: var(--dh-border) !important;
}
#nextSection a, #smartFilter :is(.paramsBoxTitle, label, .checkedItem, .hintValue),
#catalogLine :is(.label, .dropDownSelected, .dropDownItem) {
  color: var(--dh-text) !important;
}
#nextSection .cnt { color: var(--dh-catalog-secondary) !important; }
#nextSection li:hover { background: var(--dh-catalog-hover); }
#nextSection a:hover, #smartFilter :is(a, .hintValue .close) {
  color: var(--dh-catalog-link) !important;
}
#smartFilter :is(.dropdown, .dropdownList, .hintValue),
#catalogLine :is(.dropDownList, .dropDownItems, .dropDownItem) {
  background-color: var(--dh-card) !important;
  border-color: var(--dh-catalog-input-border) !important;
}
#smartFilter :is(.dropdownList, .hintValue), #catalogLine .dropDownItems {
  box-shadow: 0 8px 20px #0002;
}
#smartFilter .dropdownList { max-height: 260px; overflow-y: auto; }
/* Absolute dropdowns must escape their expanded property panel. */
#smartFilter .params:has(> .dropdown):not(.collapsed) { overflow: visible; }
#smartFilter .dropdownList :is(.selected, .item:hover),
#catalogLine :is(.dropDownItem:hover, .dropDownItem.selected) {
  background: var(--dh-catalog-hover) !important;
  color: var(--dh-text) !important;
}
#smartFilter :is(input[type="text"], select, textarea) {
  background: var(--dh-page) !important;
  border: 1px solid var(--dh-catalog-input-border) !important;
  color: var(--dh-text) !important;
  border-radius: 6px;
}
#smartFilter input::placeholder { color: var(--dh-catalog-secondary) !important; opacity: 1; }
#smartFilter .disabled, #smartFilter .disabled label { color: var(--dh-catalog-secondary) !important; }
#smartFilter .params { scrollbar-color: var(--dh-catalog-input-border) var(--dh-card); }
#smartFilter .paramsBox { padding: 18px; }
#smartFilter .rangeSlider { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#smartFilter .rangeSlider label { margin: 0; }
#smartFilter .rangeSlider input[type="text"] {
  flex: 1 1 60px;
  width: 60px;
  min-width: 0;
  margin: 0;
  height: 36px;
  padding-inline: 6px;
  font-variant-numeric: tabular-nums;
}
#smartFilter .rangeSlider .slider { flex-basis: 100%; }
#smartFilterControls :is(input, button, a), #catalog .oSmartFilter {
  min-height: 40px;
  border-radius: 6px;
  background: #ffad60 !important;
  color: #24170d !important;
}
#smartFilterControls :is(input[type="reset"], #del_filter) {
  background: var(--dh-page) !important;
  border: 1px solid var(--dh-catalog-input-border);
  color: var(--dh-text) !important;
}
#smartFilterControls #set_filter, #smartFilterControls #set_filter span { color: #24170d !important; }
html[data-theme="dark"] #smartFilter :is(.propExpander, .checkedItem),
html[data-theme="dark"] #catalogLine .dropDownSelected {
  background-image: none;
}
html[data-theme="dark"] #smartFilter .propExpander::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border: solid var(--dh-text);
  border-width: 0 1px 1px 0;
  transform: rotate(-45deg);
  left: 6px;
  top: 8px;
}
html[data-theme="dark"] :is(#smartFilter .checkedItem, #catalogLine .dropDownSelected)::after {
  content: "";
  position: absolute;
  right: 12px;
  top: calc(50% - 4px);
  width: 6px;
  height: 6px;
  border: solid var(--dh-text);
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}
#catalogLine .dropDownSelected { position: relative; padding-right: 30px; }
#catalogLine .dropDownList { border-radius: 6px; }
#catalogLine .dropDownItems { border-radius: 6px; overflow: hidden; }
#catalog .bx-pagination-container a,
#catalog .bx-pagination-container span { border-color: var(--dh-border); }
#catalog .bx-pagination-container a > span {
  background: var(--dh-card);
  color: var(--dh-text);
}
#catalog .bx-pagination-container .bx-active > span {
  background: #ffad60;
  color: #24170d !important;
}
#catalog .bx-pagination-container :is(.bx-pag-prev, .bx-pag-next) > span {
  background: var(--dh-card);
  color: var(--dh-catalog-secondary) !important;
}
#catalog :is(.skuPropertyLink, .oSkuCheckedItem, .oSkuPropertyItemLink),
#catalog :is(#catalogLineList, #catalogTableList) :is(.name, .price, .prop a, .article, .skuPropertyName, .label) {
  color: var(--dh-text) !important;
}
#catalog :is(#catalogLineList, #catalogTableList) :is(.item, .column, .article, td),
#catalog :is(.oSkuDropdown, .oSkuDropdownList) {
  background-color: var(--dh-card) !important;
  border-color: var(--dh-border) !important;
}
#catalogSection .product .optional .label { color: var(--dh-catalog-secondary); }
#catalog :is(.addCart, .addCart span), .zr-cookie-banner__button {
  background-color: #ffad60 !important;
  color: #24170d !important;
}
#catalog .addCart img { filter: brightness(.2); }
#catalog .marker, #catalogElement .marker { background-color: #38505a !important; color: #fff !important; }
#catalogSection .product .optional :is(.inStock, .inStock span) { color: #46712c !important; }
html[data-theme="dark"] #catalogSection .product .optional :is(.inStock, .inStock span) { color: #a1d483 !important; }
/* The grid mode gets gutters; LINE and TABLE retain the original layout. */
@media (min-width: 44.001em) {
  #catalogSection > .productList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 14px;
    margin: 0;
    border: 0;
    width: 100%;
  }
  #catalogSection > .productList::after { content: none; }
  #catalogSection > .productList > .product {
    float: none;
    width: 100% !important;
    height: auto !important;
    min-width: 0;
    padding: 0;
    border: 0 !important;
    background: transparent;
  }
  #catalogSection > .productList > .product::before { content: none; }
  #catalogSection > .productList .tabloid {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    padding: 12px;
    border: 1px solid var(--dh-border) !important;
    box-shadow: none;
  }
  #catalogSection > .productList .productTable { display: block; }
  #catalogSection > .productList :is(.productColImage, .productColText) { display: block; min-width: 0; width: 100%; }
  #catalogSection > .productList .picture {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1;
    margin-bottom: 12px;
  }
  #catalogSection > .productList .picture img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }
  #catalogSection > .productList .name {
    height: 84px !important;
    line-height: 21px !important;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
  }
  #catalogSection > .productList .name .middle { display: contents !important; line-height: inherit !important; }
  #catalogSection > .productList .price { margin-bottom: 12px; }
}
/* Desktop/mobile product navigation and linked characteristics use the same palette. */
#catalogElement :is(#elementNavigation, #elementSmallNavigation) {
  background: var(--dh-catalog-panel);
  border-color: var(--dh-border);
}
#catalogElement :is(#elementNavigation, #elementSmallNavigation) .tab a {
  color: var(--dh-text);
}
#catalogElement :is(#elementNavigation, #elementSmallNavigation) .tab.active a,
#catalogElement :is(#elementNavigation, #elementSmallNavigation) .tab a:hover {
  background: var(--dh-catalog-hover);
  color: var(--dh-catalog-link);
}
#catalogElement #browse .propertyTable :is(.propertyName, .propertyValue) {
  background: var(--dh-page) !important;
  color: var(--dh-text) !important;
  overflow-wrap: anywhere;
}
#catalogElement #browse .propertyTable .propertyName::after { border-color: var(--dh-border); }
#catalogElement #browse .propertyTable a { color: var(--dh-catalog-link) !important; }
#catalogElement :is(.morePropertiesLink, #elementProperties .analog, #delivery .wrap a, #delivery .wrap a span) {
  color: var(--dh-catalog-link) !important;
}
#catalogElement .detail-deliveries-loader-text { color: var(--dh-catalog-secondary); }
#catalogElement :is(#tableContainer, #elementContainer, #elementTools, .mainTool) { border-color: var(--dh-border); }
#catalogElement #elementContainer > div { border-color: var(--dh-border); }
html[data-theme="dark"] #catalogElement .elementProperties .heading,
html[data-theme="dark"] #catalogElement :is(.reviewAddButton, .reviewCount, .catalogArticle) { color: var(--dh-text); }
/* Reuse the real mobile button and its existing persistence/event handler on desktop. */
.dh-panel-utility > .dh-theme-menu { display: none; }
@media (min-width: 64.001em) {
  .dh-panel-header .dh-mobile-theme-toggle {
    position: relative; display: inline-flex; align-items: center; justify-content: space-between;
    flex: 0 0 4.3rem; width: 4.3rem; min-height: 2.75rem; padding: .5rem .6rem;
    border: 1px solid #ffffff30; border-radius: 2rem; background: #3b3e41; color: #eee;
    cursor: pointer; box-sizing: border-box;
  }
  .dh-mobile-theme-toggle .dh-theme-thumb {
    position: absolute; left: .3rem; top: 50%; width: 1.85rem; height: 1.85rem;
    margin-top: -.925rem; border-radius: 50%; background: #f2a341; box-shadow: 0 2px 5px #0002;
    transition: transform .25s cubic-bezier(.2,.7,.3,1);
  }
  .dh-mobile-theme-toggle[aria-pressed="true"] .dh-theme-thumb { transform: translateX(1.85rem); background: #d1d4d6; }
  .dh-mobile-theme-toggle svg { position: relative; z-index: 1; display: block; width: 1.1rem; height: 1.1rem; stroke: currentColor; fill: none; stroke-width: 1.7; }
  .dh-mobile-theme-toggle[aria-pressed="false"] .dh-theme-sun,
  .dh-mobile-theme-toggle[aria-pressed="true"] .dh-theme-moon { color: #292b2e; }
}
.zr-cookie-banner {
  background: var(--dh-card) !important;
  border-top: 1px solid var(--dh-border);
  color: var(--dh-text) !important;
}
.zr-cookie-banner__text :is(p, span) { color: var(--dh-text) !important; }
.zr-cookie-banner__text a { color: var(--dh-catalog-link) !important; }
:is(#catalog, #smartFilter, #nextSection, #catalogElement) :is(a, input, button, select, textarea):focus-visible,
.dh-mobile-theme-toggle:focus-visible {
  outline: 2px solid #c06b1b !important;
  outline-offset: 3px;
}
@media (max-width: 44em) {
  #catalogSection .product .picture { min-height: 0; }
  #nextSection .title::before {
    background-color: var(--dh-card);
    border-left: 1px solid var(--dh-border);
  }
  html[data-theme="dark"] #nextSection .title::before { filter: invert(.8); }
}
@media (prefers-reduced-motion: reduce) {
  .dh-mobile-theme-toggle .dh-theme-thumb { transition: none; }
}
