/* ===== Zmienne ===== */
:root{
  --mh-bg:#ffffff;
  --mh-text:#111111;
  --mh-muted:#000000;
  --mh-border:#e7e7e7;
  --mh-success:#2fa84f;
  --mh-danger:#c43d3d;
  --mh-radius:14px;
  --mh-shadow:0 20px 45px rgba(0,0,0,.10);
  --mh-top: 84px;           /* desktop: pod inputem (JS) */
  --mh-avail: 72vh;         /* desktop: dostępna wys. panelu (JS) */
  --mh-maxw: 1360px;
  --mh-sidepad: 16px;
  --mh-cta-h: 54px;         /* mobile – pełne; desktop niżej 27px */

  --mh-badge-bg:#111;       /* kolory badge */
  --mh-badge-txt:#fff;
  --mh-discount-bg:#ff4d4d;
  --mh-discount-txt:#fff;
}
.cs-ui, .cs-ui *{ font-family:"Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }

/* blokada tła – bez touch-action, by nie blokować panelu */
html.cs-lock, body.cs-lock{ overflow:hidden !important; height:100%; }

/* ===== Pasek ===== */
.searchbar{ position:relative; width:100%; max-width:980px; margin:0 auto; }
.cs-field{ position:relative; }
.csSearchBox{ box-sizing:border-box; width:100%; height:36px; line-height:36px; padding:0 36px 0 8px; font-size:16px; color:#111; background:transparent; border:none; border-bottom:1.5px solid #bfbfbf; outline:none; }
.csSearchBox::placeholder{ color:#adadad; font-weight:400; }

/* Zabezpieczenie przed FOUC (na desktopie placeholder bez stylowania przez chwilę): */
.cs-ui:not(.ready) .csSearchBox{ visibility:hidden; }

/* Ikona w polu input (desktop) */
.cs-ico{ position:absolute; right:10px; top:50%; transform:translateY(-50%); width:18px; height:18px; fill:#9aa0a6; background:none !important; }
.searchbar .cs-ico path{ fill:currentColor; }

/* Przycisk mobilny (twardy reset: żadnych ramek ani stylów z motywu) */
.cs-ico-btn{ all:unset; display:none; background:transparent !important; border:0 !important; box-shadow:none !important; padding:8px; line-height:0; cursor:pointer; appearance:none; -webkit-appearance:none; }
.cs-ico-btn .cs-ico{ position:static; width:30px; height:30px; color:#000; transform:none; display:block; background:none !important; }
.cs-ico-btn:active .cs-ico{ transform:scale(1.12); transition:transform .12s ease; }

.cs-ui:not(.ready) .cs-ico, .cs-ui:not(.ready) .cs-ico-btn{ opacity:0; }
.cs-ui.ready .cs-ico, .cs-ui.ready .cs-ico-btn{ opacity:1; transition:opacity .22s ease; }

/* ===== Panel (desktop) ===== */
.search-panel{ position:fixed; left:0; right:0; top:var(--mh-top); background:transparent; z-index:99999; padding:0; }
/* twarde ukrycie, gdy element ma atrybut hidden – zabezpiecza przed „duchem/kwadratem” */
.search-panel[hidden]{ display:none !important; }

.mh-shell{
  box-sizing:border-box; max-width:var(--mh-maxw); margin-left:auto; margin-right:auto;
  background:var(--mh-bg); border:1px solid var(--mh-border); border-radius:var(--mh-radius);
  box-shadow:var(--mh-shadow); padding:12px var(--mh-sidepad);
  max-height:var(--mh-avail);
  display:grid;
  grid-template-rows: auto 1fr; /* top | CONTENT */
  row-gap:12px;
  overflow:hidden;
  overscroll-behavior:contain; /* nie przerzucaj scrolla na body */
}
.mh-top{ display:flex; justify-content:flex-end; align-items:center; gap:8px; }
.mh-close{ width:32px; height:32px; border-radius:10px; border:1px solid var(--mh-border); background:#fff; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.mh-close:hover{ background:#f7f7f7; }

/* ===== Siatka: hero + prawa kolumna ===== */
.mh-panel{ display:grid; gap:18px; align-items:start; min-height:0; }
.mh-panel--two{ grid-template-columns:40% 60%; grid-template-areas:"hero right"; } /* 40/60 */
.mh-panel--one{ grid-template-columns:1fr; grid-template-areas:"right"; }
.mh-col--hero{ grid-area:hero; min-height:0; }
.mh-right{ grid-area:right; display:flex; flex-direction:column; min-height:0; }

/* Duży produkt */
.mh-hero{ position:relative; display:block; border:1px solid var(--mh-border); border-radius:14px; overflow:hidden; text-decoration:none; color:inherit; background:#fafafa; }
.mh-hero--placeholder{ background:#fff; }
.mh-hero__img{ width:100%; height:240px; object-fit:cover; background:#f4f4f4; display:block; }
.mh-hero__body{ padding:12px; }
.mh-hero__title{ font-size:18px; line-height:1.35; margin:0 0 6px; color:var(--mh-text); display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.mh-price{ font-size:18px; font-weight:700; margin:6px 0 2px; }
.mh-price--old{ text-decoration:line-through; color:var(--mh-muted); font-weight:500; }
.mh-price--now{ font-weight:800; }
.mh-discount{ display:inline-block; padding:2px 8px; font-size:11px; line-height:1.6; border-radius:999px; background:var(--mh-discount-bg); color:var(--mh-discount-txt); margin-left:8px; }
.mh-stock{ font-size:12px; font-weight:700; letter-spacing:.04em; }
.mh-stock--in{ color:var(--mh-success);} .mh-stock--out{ color:var(--mh-danger); }

/* Badges */
.mh-thumb{ position:relative; }
.mh-badges{
  position:absolute; left:6px; top:6px; display:flex; gap:6px; flex-wrap:wrap;
}
.mh-badge{
  display:inline-block; background:var(--mh-badge-bg); color:var(--mh-badge-txt);
  font-size:10px; line-height:1; padding:6px 8px; border-radius:999px; font-weight:700; letter-spacing:.02em;
}

/* Prawa: lista + CTA */
.mh-list{
  display:grid; gap:10px; flex:1 1 auto; overflow:auto; padding-right:6px; min-height:0;
  -webkit-overflow-scrolling:touch; overscroll-behavior:contain; touch-action: pan-y;
}
.mh-list::-webkit-scrollbar{ width:8px; }
.mh-list::-webkit-scrollbar-thumb{ background:#e1e1e1; border-radius:999px; }
.mh-item{ display:grid; grid-template-columns:76px 1fr; gap:12px; padding:10px; border-radius:12px; text-decoration:none; color:inherit; border:1px solid var(--mh-border); background:#fff; }
.mh-item:hover{ background:#f9f9f9; }
.mh-item__img{ width:76px; height:76px; object-fit:cover; border-radius:10px; background:#f4f4f4; display:block; }
.mh-item__title{ font-size:14px; line-height:1.35; color:var(--mh-text); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.mh-item__meta{ display:flex; gap:10px; align-items:center; margin-top:6px; flex-wrap:wrap; }

.mh-cta{
  flex:0 0 auto;
  display:flex; justify-content:center; align-items:center;
  margin-top:auto; padding-top:14px;
}

/* Drobne tytuły sekcji w panelu (np. Ostatnio oglądane) */
.mh-section-title{
  color: var(--mh-muted);
  font-size: 12px;
  letter-spacing: .04em;
  font-weight: 700;
  text-transform: uppercase;
  margin: 4px 0 2px 2px;
}

/* Loader dla doładowań */
.mh-loader{ text-align:center; color:var(--mh-muted); font-size:13px; padding:10px 0; }

/* CTA */
.mh-btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:var(--mh-cta-h); padding:0 22px; border-radius:999px; text-decoration:none; font-weight:600; letter-spacing:.02em;
  transition: transform .12s ease; will-change: transform; user-select:none; -webkit-tap-highlight-color:transparent; }
.mh-btn--accent{ background:#000; color:#fff !important; }
.mh-btn--accent:hover,
.mh-btn--accent:focus,
.mh-btn--accent:active{ transform:scale(1.05); color:#fff !important; }
.mh-btn--accent:visited{ color:#fff; }

/* Podświetlenie frazy */
.mark{ background:linear-gradient(transparent 60%, #ffec8a 60%); }

/* ===== Mobile – pełnoekranowy overlay i kompaktowy przycisk w nagłówku ===== */
@media (max-width: 768px){
  /* Kompakt: nie rozpychaj headera – brak 100% szer. i brak sztywnego 64px */
  .searchbar{
    display:inline-flex;
    align-items:center;
    width:auto;
    max-width:none;
    height:auto;
    margin:0;
  }
  .cs-field{ display:flex; align-items:center; }
  .csSearchBox{ display:none; }
  .cs-field > .cs-ico{ display:none; }
  .cs-ico-btn{ display:inline-flex; }

  /* Fullscreen overlay – przykrywa całą stronę przy otwarciu */
  .search-panel{ inset:0 !important; }
  .mh-shell{
    height:100vh; height:100dvh; max-height:100vh; max-height:100dvh;
    border-radius:0;
  }

  /* Górny pasek — większy + zielona poświata */
  .mh-top--mobile{ justify-content:space-between; }
  .mh-mobile-field{ position:relative; flex:1 1 auto; }
  .mh-mobile-field .mh-m-input{
    width:100%;
    height:56px;
    padding:0 44px 0 14px;
    font-size:18px;
    border:2px solid #2fa84f;
    border-radius:12px;
    outline:none;
    background:#fff;
    color:#111;
    box-shadow:
      0 0 0 4px rgba(47,168,79,.14),
      0 0 22px rgba(47,168,79,.22);
  }
  .mh-mobile-field .mh-m-ico{
    position:absolute; right:12px; top:50%; transform:translateY(-50%);
    width:22px; height:22px; color:#9aa0a6;
  }

  .mh-panel--two{ grid-template-columns:1fr; grid-template-areas:"right"; }
  .mh-col--hero{ display:none !important; }
  .mh-right{ min-height:0; display:flex; flex-direction:column; }
  .mh-list{ min-height:0; max-height:none; }
}

/* Elementory – tylko gdy overlay jest otwarty (eliminuje konflikty z koszykiem na mobile) */
.cs-overlay-open .elementor-location-header,
.cs-overlay-open .elementor-section,
.cs-overlay-open .elementor-container{ overflow:visible !important; }

/* Fade‑down panelu */
.search-panel .mh-shell{ opacity:0; transform: translateY(-8px); will-change: transform, opacity; }
.search-panel.is-open .mh-shell{ animation: mh-fadeDown .24s cubic-bezier(.16,.84,.44,1) forwards; }
@keyframes mh-fadeDown{ from{ opacity:0; transform: translateY(-8px); } to{ opacity:1; transform: translateY(0); } }

/* Fade‑in obrazków */
img.fade-img{ opacity:0; transition:opacity .26s ease; }
img.fade-img.is-loaded{ opacity:1; }

/* ===== Host wyników /search/ ===== */
#csResultsHost{
  width:100%;
  display:block;
  min-width:100%;
  flex:0 0 100%;
}

/* ===== /search/ (desktop 1360 px) ===== */
.csResults{
  width: min(100%, var(--mh-maxw));
  margin: 20px auto 32px;
  padding: 0 var(--mh-sidepad);
  box-sizing: border-box;
}
.csResults .cs-title{ font-size:18px; margin:0 0 6px; }
.csResults .cs-summary{ color: var(--mh-muted); margin: 0 0 18px; }
.csResults .cs-grid{ display:grid; gap:16px; grid-template-columns: repeat(4, minmax(0,1fr)); }
.csResults .cs-card{ display:block; text-decoration:none; color:inherit; border:1px solid var(--mh-border); border-radius:12px; background:#fff; padding:10px; width:100%; box-sizing:border-box; }
.csResults .cs-card .cs-thumb{ position:relative; }
.csResults .cs-card img{
  width:100%;
  height:auto;
  aspect-ratio: 1 / 1;     /* wymuszenie kwadratu – desktop i mobile */
  object-fit:cover;
  background:#f4f4f4;
  border-radius:10px;
  display:block;
}
.csResults .cs-card .mh-badges{ position:absolute; left:8px; top:8px; }
.csResults .cs-card .cs-price-row{ margin-top:8px; }

/* Toolbar sort+filtry */
.cs-toolbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; flex-wrap:wrap; margin-bottom:12px;
}
.cs-label{ color: var(--mh-muted); font-size:13px; margin-right:6px; }
.cs-select{ min-height:34px; border-radius:8px; border:1px solid var(--mh-border); padding: 0 10px; background:#fff; }
.cs-check{ user-select:none; }
.cs-check input{ margin-right:8px; }

/* breakpointy siatki */
@media (max-width: 1200px){ .csResults .cs-grid{ grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 900px){  .csResults .cs-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* --- MOBILE FIX: pełna szerokość na telefonach, 1 kolumna, brak poziomego scrolla --- */
@media (max-width: 768px){
  #csResultsHost{ overflow-x:hidden; }
  .csResults{
    max-width:100%;
    width:100%;
    margin: 12px auto 24px;
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  .csResults .cs-title{ font-size:16px; }
  .csResults .cs-summary{ font-size:14px; }
  .csResults .cs-grid{
    grid-template-columns: 1fr !important;
    gap:12px;
  }
  .csResults .cs-card{ border-radius:14px; }
  /* obrazek pozostaje kwadratem dzięki aspect-ratio; nie ustawiamy już height */
}

/* ===== Zero-results ===== */
.cs-zero .pill{
  display:inline-block; border:1px solid var(--mh-border); border-radius:999px; padding:6px 12px;
  margin:6px 6px 0 0; text-decoration:none; color:inherit; background:#fff; font-weight:600; font-size:13px;
}
.cs-zero__alts{ display:flex; align-items:center; gap:12px; margin:10px 0 16px; flex-wrap:wrap; }
.cs-zero__caption{ color: var(--mh-muted); }
.cs-zero__cta{ margin: 8px 0 16px; }

/* ===== Desktop: CTA o połowę mniejsze ===== */
@media (min-width: 769px){
  :root{ --mh-cta-h: 27px; }
  .mh-btn{ padding: 0 11px; }
}
