/* Penshelf Header Search & Trust Bar v1.2.0
 * Discovery-led search with a stable root folder. The search panel deliberately
 * sits below Penshelf Commerce Mega Menu (which uses z-index: 99999).
 */
.psh-topbar {
  --psh-topbar-bg: #0b2139;
  --psh-topbar-text: #fff;
  --psh-topbar-accent: #c99735;
  width: 100%;
  background: var(--psh-topbar-bg);
  color: var(--psh-topbar-text);
  font-size: 11px;
  line-height: 1;
}

.psh-topbar__inner {
  width: min(100% - 32px, 1320px);
  min-height: 30px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(22px, 4vw, 58px);
}

.psh-topbar__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: inherit !important;
  text-decoration: none !important;
  white-space: nowrap;
  opacity: .96;
}
.psh-topbar__item:hover,.psh-topbar__item:focus-visible{color:inherit!important;opacity:1}
.psh-topbar__item--track{margin-left:auto}
.psh-topbar__icon{width:16px;height:16px;object-fit:contain;flex:0 0 16px}
.psh-topbar__fallback-icon{color:var(--psh-topbar-accent);font-size:10px}
.psh-topbar__label{overflow:hidden;text-overflow:ellipsis}

/* Search field ------------------------------------------------------------ */
.psh-header-search-wrap {
  --psh-search-primary: var(--primary-color, #446084);
  --psh-search-ink: #18283e;
  --psh-search-muted: #737b87;
  --psh-search-border: rgba(16, 36, 62, .15);
  --psh-search-divider: rgba(16, 36, 62, .10);
  --psh-search-surface: rgba(255, 255, 255, .99);
  --psh-search-soft: #f7f8fa;
  width: clamp(460px, 48vw, 700px);
  max-width: 100%;
  margin-inline: auto;
  font-family: inherit;
}

.psh-header-search {
  position: relative;
  z-index: 9100;
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(210px,1fr) minmax(142px,175px) 48px;
  align-items: stretch;
  width: 100%;
  margin: 0;
  padding: 3px;
  overflow: hidden;
  background: var(--psh-search-surface);
  border: 1px solid var(--psh-search-border);
  border-radius: 11px;
  box-shadow: 0 8px 24px rgba(15,23,42,.10),0 1px 2px rgba(15,23,42,.06);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: border-color .18s ease,box-shadow .18s ease,transform .18s ease;
}
.psh-header-search:hover{border-color:rgba(31,41,55,.22);box-shadow:0 10px 28px rgba(15,23,42,.13),0 1px 2px rgba(15,23,42,.06)}
.psh-header-search:focus-within{border-color:var(--psh-search-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--psh-search-primary) 18%,transparent),0 10px 28px rgba(15,23,42,.13)}

.psh-header-search input[type="search"].psh-header-search__input,
.psh-header-search select.psh-header-search__category {
  width:100%;height:40px;min-height:40px;margin:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;color:var(--psh-search-ink);font-family:inherit;font-size:13px;line-height:1.3
}
.psh-header-search input[type="search"].psh-header-search__input{padding:0 17px;background:transparent;font-weight:400;appearance:none;-webkit-appearance:none}
.psh-header-search input[type="search"].psh-header-search__input::placeholder{color:var(--psh-search-muted);opacity:.92}
.psh-header-search input[type="search"].psh-header-search__input::-webkit-search-cancel-button{opacity:.55;cursor:pointer}
.psh-header-search select.psh-header-search__category{padding:0 34px 0 14px;background-color:var(--psh-search-soft);border-left:1px solid var(--psh-search-divider)!important;border-radius:7px 0 0 7px!important;color:#374151;font-weight:500;cursor:pointer;text-overflow:ellipsis}
.psh-header-search input[type="search"].psh-header-search__input:focus,.psh-header-search select.psh-header-search__category:focus{outline:none!important}
.psh-header-search__submit{display:inline-flex;align-items:center;justify-content:center;align-self:stretch;width:44px;min-width:44px;height:40px;min-height:40px;margin:0!important;padding:0!important;border:0!important;border-radius:7px!important;background:var(--psh-search-primary)!important;color:#fff!important;cursor:pointer;box-shadow:0 3px 10px color-mix(in srgb,var(--psh-search-primary) 28%,transparent);transition:transform .16s ease,filter .16s ease,box-shadow .16s ease}
.psh-header-search__submit svg{width:19px;height:19px}
.psh-header-search__submit:hover{filter:brightness(.92);transform:translateY(-1px);box-shadow:0 5px 14px color-mix(in srgb,var(--psh-search-primary) 34%,transparent)}
.psh-header-search__submit:active{transform:translateY(0);filter:brightness(.88)}
.psh-header-search__submit:focus-visible{outline:2px solid #fff!important;outline-offset:-4px}

/* Discovery panel --------------------------------------------------------- */
.psh-search-panel[hidden]{display:none!important}
.psh-search-panel{
  --psh-search-panel-top: 100px;
  position:fixed;
  z-index:9000; /* Intentionally lower than .psmm-panel (99999). */
  top:var(--psh-search-panel-top);
  left:50%;
  transform:translateX(-50%);
  width:min(1180px,calc(100vw - 28px));
  max-height:min(720px,calc(100vh - var(--psh-search-panel-top) - 16px));
  overflow:auto;
  overscroll-behavior:contain;
  padding:0;
  background:#fff;
  color:#17263a;
  border:1px solid rgba(16,36,62,.13);
  border-radius:12px;
  box-shadow:0 24px 70px rgba(12,28,48,.20),0 4px 14px rgba(12,28,48,.08);
  text-align:left;
  scrollbar-width:thin;
}
.psh-search-panel a{text-decoration:none!important}
.psh-search-panel__discovery,.psh-search-panel__results{padding:18px 18px 20px}
.psh-search-panel__results{min-height:240px}

.psh-discovery-top{display:grid;grid-template-columns:1fr 1fr;gap:18px;padding-bottom:14px;border-bottom:1px solid #e9edf2}
.psh-discovery-block{min-width:0}
.psh-discovery-title-row,.psh-product-rail__head{display:flex;align-items:center;justify-content:space-between;gap:14px}
.psh-discovery-title,.psh-live-group__title{margin:0 0 10px!important;color:#12243b!important;font-size:14px!important;font-weight:700!important;line-height:1.25!important;text-transform:none!important;letter-spacing:0!important}
.psh-discovery-title-row .psh-discovery-title,.psh-product-rail__head .psh-discovery-title{margin-bottom:0!important}
.psh-text-button{appearance:none;border:0;background:none;padding:3px 0;color:var(--primary-color,#446084);font:inherit;font-size:12px;cursor:pointer;text-decoration:underline;text-underline-offset:2px}

.psh-search-chips{display:flex;flex-wrap:wrap;gap:8px}
.psh-search-chip{display:inline-flex;align-items:center;gap:7px;max-width:100%;min-height:32px;padding:6px 10px;border:1px solid #dce3eb;border-radius:7px;background:#fff;color:#17263a!important;font-size:12.5px;line-height:1.2;transition:border-color .15s ease,background .15s ease,transform .15s ease}
.psh-search-chip:hover,.psh-search-chip:focus-visible{border-color:color-mix(in srgb,var(--primary-color,#446084) 55%,#dce3eb);background:#f9fbfd;transform:translateY(-1px);outline:none}
.psh-search-chip--recent span{font-size:14px;color:#536176}

.psh-brand-strip{padding:14px 0;border-bottom:1px solid #e9edf2}
.psh-brand-grid{display:flex;gap:10px;overflow-x:auto;padding:10px 1px 2px;scrollbar-width:none}
.psh-brand-grid::-webkit-scrollbar{display:none}
.psh-brand-card{flex:0 0 132px;height:62px;display:flex;align-items:center;justify-content:center;padding:8px 12px;border:1px solid #dce3eb;border-radius:7px;background:#fff;color:#17263a!important;font-size:12px;font-weight:700;text-align:center;transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease}
.psh-brand-card img{display:block;max-width:108px;max-height:42px;width:auto;height:auto;object-fit:contain}
.psh-brand-card:hover,.psh-brand-card:focus-visible{border-color:color-mix(in srgb,var(--primary-color,#446084) 45%,#dce3eb);box-shadow:0 5px 14px rgba(15,23,42,.07);transform:translateY(-1px);outline:none}

.psh-product-rail{padding:16px 0 2px;border-bottom:1px solid #e9edf2}
.psh-product-rail:last-child{border-bottom:0}
.psh-product-rail__controls{display:flex;gap:7px}
.psh-rail-arrow{width:29px;height:29px;padding:0;border:1px solid #d8e0e9;border-radius:50%;background:#fff;color:#17263a;font-size:19px;line-height:1;cursor:pointer;display:grid;place-items:center}
.psh-rail-arrow:hover,.psh-rail-arrow:focus-visible{border-color:var(--primary-color,#446084);color:var(--primary-color,#446084);outline:none}
.psh-product-rail__track{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(150px,1fr);grid-template-rows:1fr;gap:12px;overflow-x:auto;scroll-snap-type:x proximity;padding:12px 2px 14px;scrollbar-width:none}
.psh-product-rail__track::-webkit-scrollbar{display:none}
.psh-product-card{min-width:0;display:flex;flex-direction:column;color:#111827!important;scroll-snap-align:start}
.psh-product-card__image-wrap{position:relative;display:block;width:100%;aspect-ratio:1/1.05;border:1px solid #dce3eb;border-radius:9px;background:#fff;overflow:hidden}
.psh-product-card__image{display:block;width:100%;height:100%;object-fit:contain;padding:12px;transition:transform .18s ease}
.psh-product-card:hover .psh-product-card__image{transform:scale(1.035)}
.psh-product-card__badge{position:absolute;z-index:1;top:7px;left:7px;padding:3px 6px;border-radius:999px;background:var(--primary-color,#446084);color:#fff;font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.psh-product-card__name{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;margin:8px 1px 4px;font-size:12.5px;line-height:1.35;min-height:34px;color:#111827}
.psh-product-card__price{font-size:12px;line-height:1.3;color:var(--primary-color,#446084);font-weight:600}
.psh-product-card__price del{opacity:.48;font-size:10.5px;margin-right:4px}.psh-product-card__price ins{text-decoration:none}

/* Predictive result mode -------------------------------------------------- */
.psh-search-loading{min-height:220px;display:flex;align-items:center;justify-content:center;gap:10px;color:#647084;font-size:13px}
.psh-search-spinner{width:18px;height:18px;border:2px solid #d9e1e9;border-top-color:var(--primary-color,#446084);border-radius:50%;animation:psh-spin .7s linear infinite}
@keyframes psh-spin{to{transform:rotate(360deg)}}
.psh-live-results{display:grid;grid-template-columns:minmax(210px,28%) minmax(0,1fr);gap:22px}
.psh-live-results__sidebar{padding-right:18px;border-right:1px solid #e7ebf0}
.psh-live-group+.psh-live-group{margin-top:18px}
.psh-live-query,.psh-live-link{display:flex;align-items:center;gap:9px;width:100%;min-height:36px;padding:7px 8px;border-radius:7px;color:#24344a!important;font-size:12.5px}
.psh-live-link{justify-content:space-between}
.psh-live-query:hover,.psh-live-query:focus-visible,.psh-live-link:hover,.psh-live-link:focus-visible{background:#f4f7fa;color:var(--primary-color,#446084)!important;outline:none}
.psh-live-query__icon{display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:#eef2f6;color:#48576b;font-size:14px}
.psh-view-all{color:var(--primary-color,#446084)!important;font-size:12px;font-weight:600}
.psh-live-product-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:10px}
.psh-live-product{min-width:0;display:grid;grid-template-columns:72px minmax(0,1fr);gap:9px;align-items:center;padding:8px;border:1px solid #e1e6ec;border-radius:8px;background:#fff;color:#17263a!important;transition:border-color .15s ease,box-shadow .15s ease}
.psh-live-product:hover,.psh-live-product:focus-visible{border-color:color-mix(in srgb,var(--primary-color,#446084) 45%,#e1e6ec);box-shadow:0 5px 15px rgba(15,23,42,.06);outline:none}
.psh-live-product__image{display:block;width:72px;height:72px;border-radius:7px;background:#fafbfc;overflow:hidden}
.psh-live-product__image img{display:block;width:100%;height:100%;object-fit:contain;padding:6px}
.psh-live-product__body{min-width:0;display:block}
.psh-live-product__name{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-size:12.5px;line-height:1.35;font-weight:600}
.psh-live-product__price{display:block;margin-top:5px;font-size:11.5px;color:var(--primary-color,#446084);font-weight:600}.psh-live-product__price del{opacity:.45;font-size:10px}.psh-live-product__price ins{text-decoration:none}
.psh-live-empty{padding:26px 12px;margin:10px 0 0;background:#f7f9fb;border-radius:8px;color:#657184;text-align:center;font-size:13px}

@supports not (color:color-mix(in srgb,black 50%,white)){
  .psh-header-search:focus-within{box-shadow:0 0 0 3px rgba(68,96,132,.18),0 10px 28px rgba(15,23,42,.13)}
  .psh-header-search__submit{box-shadow:0 3px 10px rgba(68,96,132,.22)}
}

.header-main .psh-header-search-wrap,.header-wrapper .psh-header-search-wrap{flex:1 1 580px;min-width:0}
.transparent .psh-header-search,.header-transparent .psh-header-search,.header-wrapper.stuck .psh-header-search{background:rgba(255,255,255,.985)}

@media (max-width:1100px){
  .psh-header-search-wrap{width:min(100%,610px)}
  .psh-header-search{grid-template-columns:minmax(175px,1fr) minmax(125px,150px) 46px}
  .psh-search-panel{width:min(980px,calc(100vw - 24px))}
  .psh-live-product-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:1024px){
  .psh-topbar__inner{gap:18px;overflow-x:auto;scrollbar-width:none}.psh-topbar__inner::-webkit-scrollbar{display:none}
  .psh-header-search-wrap{width:min(100%,560px);min-width:0}
  .psh-product-rail__track{grid-auto-columns:minmax(160px,30%)}
}
@media (max-width:849px){
  .psh-topbar{font-size:10px}.psh-topbar__inner{width:100%;padding:0 12px;min-height:28px}.psh-topbar__item--track{margin-left:0}
  .psh-header-search-wrap{width:100%}.psh-header-search{min-height:44px;grid-template-columns:minmax(0,1fr) 44px;padding:2px;border-radius:9px}.psh-header-search select.psh-header-search__category{display:none}.psh-header-search input[type="search"].psh-header-search__input,.psh-header-search__submit{height:40px;min-height:40px}
  .psh-search-panel{width:calc(100vw - 12px);max-height:calc(100vh - var(--psh-search-panel-top) - 6px);border-radius:9px}
  .psh-search-panel__discovery,.psh-search-panel__results{padding:14px 12px 16px}
  .psh-discovery-top{grid-template-columns:1fr;gap:14px}.psh-brand-card{flex-basis:112px;height:56px}.psh-brand-card img{max-width:92px;max-height:36px}
  .psh-product-rail__track{grid-auto-columns:minmax(145px,48%);gap:10px}
  .psh-live-results{grid-template-columns:1fr;gap:14px}.psh-live-results__sidebar{padding-right:0;padding-bottom:12px;border-right:0;border-bottom:1px solid #e7ebf0}.psh-live-product-grid{grid-template-columns:1fr}.psh-live-product{grid-template-columns:64px minmax(0,1fr)}.psh-live-product__image{width:64px;height:64px}
}
@media (prefers-reduced-motion:reduce){.psh-header-search,.psh-header-search__submit,.psh-search-chip,.psh-brand-card,.psh-product-card__image,.psh-live-product{transition:none}.psh-search-spinner{animation:none}}

/* v1.3.0 lazy discovery --------------------------------------------------- */
.psh-discovery-lazy:empty{display:none}
.psh-discovery-lazy .psh-search-loading--discovery{min-height:92px;border-top:1px solid #e9edf2;margin-top:14px}
