/* BlackCopper header v4: floating glass pill menu with the logo in the centre (desktop ≥1200px).
   Loaded after the critical CSS and blackcopper.css (head.tpl). Template: modules/ps_mainmenu/ps_mainmenu.tpl splits
   the menu in two lists with .bc-menu__brand between them. Below 1200px the old header layout stays. */
.bc-menu__brand { display: none; }
#mobile_top_menu_wrapper #_mobile_top_menu > ul.top-menu { margin: 0; }
@media (min-width: 768px) {
  #header .bc-menu { display: flex; justify-content: center; align-items: center; }
  #header .bc-menu > .clearfix { display: none; }
}

@media (min-width: 1200px) {
  :root { --bc-header-h: 72px; }
  #header .bc-header__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 0 16px; min-height: var(--bc-header-h); }
  #header #_desktop_logo, #header .bc-header__nav2 { display: none; }
  #header .bc-header__actions { display: contents; }
  #header .js-bc-search-toggle { grid-column: 1; grid-row: 1; justify-self: start; }
  #header .bc-header__actions > .bc-btn { grid-column: 3; grid-row: 1; justify-self: end; white-space: nowrap; }
  #header .bc-header__nav { grid-column: 2; grid-row: 1; display: block; }

  /* the pill: equal 1fr halves keep the logo exactly in the middle; no backdrop-filter here, it would trap the mega menu */
  #header .bc-menu {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 50px; padding: 0 10px; border-radius: 999px;
    background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, .16) 50%, transparent 65%) -100% 0 / 40% 100% no-repeat,
                linear-gradient(180deg, #172338 0%, #0a0f18 100%);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 10px 30px rgba(6, 12, 24, .22), inset 0 1px 0 rgba(255, 255, 255, .08);
    animation: bcPillShine 6s ease-in-out 1.2s infinite;
  }
  #header .bc-menu__list { display: flex; gap: 0; justify-content: flex-end; }
  #header .bc-menu__list--r { justify-content: flex-start; }
  #header .bc-menu__brand { display: flex; align-items: center; padding: 0 16px; }
  #header .bc-menu__brand img { display: block; height: 40px; width: auto; filter: drop-shadow(0 0 10px rgba(46, 139, 198, .55)); transition: transform .35s var(--bc-ease), filter .35s; }
  #header .bc-menu__brand:hover img { transform: scale(1.06); filter: drop-shadow(0 0 16px rgba(92, 192, 255, .8)); }

  #header .bc-menu__item > a.bc-menu__link { position: relative; padding: 15px 10px; font-size: 13px; color: #eef3fa; opacity: .82; }
  #header .bc-menu__item:hover > a.bc-menu__link, #header .bc-menu__item:focus-within > a.bc-menu__link { color: #fff; opacity: 1; }
  #header .bc-menu__item.current > a.bc-menu__link { color: #fff; opacity: 1; }
  #header .bc-menu__link::after { content: ""; position: absolute; left: 50%; right: 50%; bottom: 9px; height: 2px; border-radius: 2px; background: #5cc0ff; box-shadow: 0 0 8px #2e8bc6; transition: left .3s var(--bc-ease), right .3s var(--bc-ease); }
  #header .bc-menu__item:hover > .bc-menu__link::after, #header .bc-menu__item.current > .bc-menu__link::after { left: 10px; right: 10px; }
  /* bridge the gap between the pill and the mega panel so the hover is not lost */
  #header .bc-menu__item.has-children > .bc-menu__link::before { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 16px; }

  /* homepage: the bar sits on the dark intro until it has scrolled past (header.tpl toggles .bc-header--over) */
  #header .bc-header--over { background: #05080c; -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom-color: rgba(255, 255, 255, .06); }
  #header .bc-header--over .js-bc-search-toggle { color: #f5f5f7; }
  #header .bc-header--over .bc-menu { background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, .16) 50%, transparent 65%) -100% 0 / 40% 100% no-repeat, rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
  #header:has(.bc-header--over) .bc-topline { background: #04070b; }
  #header:has(.bc-header--over) .bc-topline__link { color: #5cc0ff; }
}
@media (min-width: 1200px) and (max-width: 1319px) {
  #header .bc-menu__item > a.bc-menu__link { padding-left: 8px; padding-right: 8px; }
  #header .bc-menu__brand { padding: 0 10px; }
}
@keyframes bcPillShine { 0%, 55% { background-position: -100% 0, 0 0; } 100% { background-position: 200% 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { #header .bc-menu { animation: none; } }

/* ---------- Search panel: floating dark glass card under the header (all widths) ---------- */
#header .bc-header #search_widget {
  display: flex; flex-direction: column; gap: 14px;
  left: 50%; right: auto; top: calc(100% + 10px); width: min(760px, calc(100vw - 24px)); padding: 16px;
  transform: translate(-50%, -10px) scale(.98); border-radius: 24px;
  background: rgba(10, 15, 24, .94); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border: 1px solid rgba(92, 192, 255, .3);
  box-shadow: 0 30px 70px rgba(2, 6, 14, .5), 0 0 48px rgba(46, 139, 198, .22), inset 0 1px 0 rgba(255, 255, 255, .08);
}
#header .bc-header.bc-search-open #search_widget { transform: translate(-50%, 0) scale(1); }
#header .bc-header #search_widget form { max-width: none; width: 100%; overflow: hidden; border-radius: 16px; }
#header .bc-header #search_widget form input[type=text] {
  height: 56px; border-radius: 16px; padding: 0 48px 0 52px; font-size: 17px; color: #f5f7fa;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14);
  transition: border-color .25s, box-shadow .25s, background .25s;
}
#header .bc-header #search_widget form input[type=text]::placeholder { color: rgba(225, 233, 243, .5); }
#header .bc-header #search_widget form input[type=text]:focus { background: rgba(255, 255, 255, .09); border-color: #5cc0ff; box-shadow: 0 0 0 4px rgba(46, 139, 198, .25), 0 0 24px rgba(46, 139, 198, .35); }
#header .bc-header #search_widget form i.search { left: 18px; top: 18px; filter: brightness(0) invert(.78); }
#header .bc-header #search_widget form input[type=text]:placeholder-shown ~ i.clear { display: none !important; }
#header .bc-header #search_widget form i.clear { top: 18px; right: 16px; filter: brightness(0) invert(.78); }
/* a scanner beam sweeps the box each time the panel opens */
#header .bc-header #search_widget form::after {
  content: ""; position: absolute; top: 6px; bottom: 6px; left: -10%; width: 3px; border-radius: 3px; pointer-events: none;
  background: #ff4d4d; box-shadow: 0 0 14px 3px rgba(255, 77, 77, .65); opacity: 0;
}
#header .bc-header.bc-search-open #search_widget form::after { animation: bcSearchBeam 1.1s cubic-bezier(.6, 0, .4, 1) .15s 1; }
@keyframes bcSearchBeam { 0% { left: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

.bc-search-chips { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; padding: 0 4px; }
.bc-search-chips__label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: rgba(225, 233, 243, .55); margin-right: 4px; }
#header .bc-search-chip {
  font-size: 13px; color: #e6eef8; padding: 7px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  transition: background .2s, border-color .2s, color .2s, transform .2s;
}
#header .bc-search-chip:hover { background: rgba(46, 139, 198, .22); border-color: #5cc0ff; color: #fff; transform: translateY(-1px); }
#search_widget:has(.ui-autocomplete:not(:empty):not([style*="display: none"])) .bc-search-chips { display: none; }

/* results (moved into the panel by header.tpl) */
#search_widget .ui-autocomplete.searchbar-autocomplete {
  position: relative !important; top: auto !important; left: auto !important; width: auto !important; order: 1;
  max-height: min(60vh, 520px); overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: transparent; border: 0; border-radius: 0; box-shadow: none; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent;
}
#search_widget .ui-autocomplete .ui-menu-item { list-style: none; margin: 0; }
#search_widget .ui-autocomplete .ui-menu-item a {
  display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 14px; cursor: pointer;
  color: #e6eef8; border: 1px solid transparent; background: transparent; position: relative;
}
#search_widget .ui-autocomplete .ui-menu-item a .product { font-size: 14px; line-height: 1.35; color: inherit; }
#search_widget .ui-autocomplete .autocomplete-thumbnail { flex: 0 0 48px; width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; float: none; margin: 0; }
#search_widget .ui-autocomplete .ui-menu-item a.ui-state-focus, #search_widget .ui-autocomplete .ui-menu-item a.ui-state-active, #search_widget .ui-autocomplete .ui-menu-item a:hover {
  background: rgba(46, 139, 198, .16); border-color: rgba(92, 192, 255, .35); color: #fff; margin: 0;
}
@media (prefers-reduced-motion: reduce) { #header .bc-header.bc-search-open #search_widget form::after { animation: none; } }
