/**
 * Motyl-Pro — Live Search Overlay (na wzór doofinder UX)
 * @package Motyl-Pro
 */

/* ===== Overlay kontener ===== */
.gl-so{
  position:fixed; inset:0; z-index:9500;
  display:none; opacity:0;
  transition:opacity .2s ease;
}
.gl-so.open{ display:block; opacity:1; }
.gl-so-backdrop{
  position:absolute; inset:0;
  background:rgba(17,17,17,.5);
  z-index:0;
}
.gl-so-inner{
  position:relative; z-index:1;
  background:#fff;
  max-width:100%;
  box-shadow:0 20px 50px rgba(0,0,0,.22);
  border-bottom:3px solid var(--red);
  animation:glSoDrop .22s ease;
  max-height:92vh; overflow-y:auto;
}
@keyframes glSoDrop{ from{ transform:translateY(-18px); opacity:0; } to{ transform:translateY(0); opacity:1; } }

/* ===== Górny pasek ===== */
.gl-so-top{
  display:flex; align-items:center; gap:14px;
  max-width:1200px; margin:0 auto;
  padding:18px 24px;
}
.gl-so-form{
  flex:1; display:flex; align-items:center; gap:10px;
  background:#f7f7f7; border:2px solid var(--gray-300);
  border-radius:var(--r); padding:0 14px;
  transition:border-color var(--t), box-shadow var(--t);
}
.gl-so-form:focus-within{ border-color:var(--red); box-shadow:0 0 0 3px rgba(251,153,66,.12); }
.gl-so-ico{ width:20px; height:20px; stroke:var(--gray-500); stroke-width:2; fill:none; flex-shrink:0; }
.gl-so-input{
  flex:1; border:none; background:transparent; outline:none;
  font-family:inherit; font-size:16px; color:var(--black);
  padding:13px 0;
}
.gl-so-input::placeholder{ color:var(--gray-500); }
.gl-so-clear{
  border:none; background:var(--gray-300); color:#fff;
  width:22px; height:22px; border-radius:50%; cursor:pointer;
  font-size:16px; line-height:1; display:flex; align-items:center; justify-content:center;
  transition:background var(--t); flex-shrink:0;
}
.gl-so-clear:hover{ background:var(--gray-500); }
.gl-so-close{
  border:none; background:none; cursor:pointer;
  width:42px; height:42px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  color:var(--gray-700); transition:background var(--t), color var(--t); flex-shrink:0;
}
.gl-so-close:hover{ background:var(--gray-100); color:var(--red); }
.gl-so-close svg{ width:24px; height:24px; stroke:currentColor; stroke-width:2; fill:none; }

/* ===== Ostatnio wyszukiwane ===== */
.gl-so-recent{
  max-width:1200px; margin:0 auto;
  padding:0 24px 14px;
}
.gl-so-recent-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-bottom:9px;
}
.gl-so-label{ font-size:13.5px; font-weight:400; color:var(--black); }
.gl-so-recent-clear{
  border:none; background:none; cursor:pointer;
  font-size:12.5px; color:var(--red); font-weight:600; text-decoration:underline;
}
.gl-so-recent-clear:hover{ color:var(--red-dark); }
.gl-so-recent-list{ display:flex; flex-wrap:wrap; gap:8px; }
.gl-so-pill{
  display:inline-flex; align-items:center; gap:6px;
  background:var(--gray-100); border:1px solid var(--gray-300);
  border-radius:999px; padding:6px 8px 6px 14px;
  font-size:13px; color:var(--gray-900);
  transition:border-color var(--t), background var(--t);
}
.gl-so-pill:hover{ border-color:var(--red); background:#fff; }
.gl-so-pill-txt{ cursor:pointer; }
.gl-so-pill-x{
  border:none; background:var(--gray-300); color:#fff;
  width:18px; height:18px; border-radius:50%; cursor:pointer;
  font-size:13px; line-height:1; display:flex; align-items:center; justify-content:center;
  transition:background var(--t);
}
.gl-so-pill-x:hover{ background:var(--red); }

/* ===== Ciało — 2 kolumny ===== */
.gl-so-body{
  display:grid; grid-template-columns:240px 1fr; gap:32px;
  max-width:1200px; margin:0 auto;
  padding:6px 24px 30px;
  border-top:1px solid var(--gray-100);
}
.gl-so-col-title{
  font-family:'DM Sans',sans-serif; font-size:16px; font-weight:400;
  letter-spacing:0; color:var(--black);
  margin:14px 0 14px;
}

/* Lewa — popularne + kategorie */
.gl-so-left{ min-width:0; }
.gl-so-popular{ list-style:none; margin:0; padding:0; }
.gl-so-popular li{ margin-bottom:2px; }
.gl-so-popular a{
  display:block; padding:7px 10px; border-radius:var(--r);
  font-size:14.5px; font-weight:300; color:var(--black); text-decoration:none;
  transition:background var(--t), color var(--t);
}
.gl-so-popular a:hover{ background:var(--gray-100); color:var(--red); }
.gl-so-cats-list{ list-style:none; margin:0; padding:0; }
.gl-so-cats-list li{ margin-bottom:2px; }
.gl-so-cats-list a{
  display:block; padding:7px 10px; border-radius:var(--r);
  font-size:14.5px; font-weight:300; color:var(--black); text-decoration:none;
  transition:background var(--t), color var(--t);
}
.gl-so-cats-list a:hover{ background:var(--gray-100); color:var(--red); }
.gl-so-cat-count{ color:var(--gray-500); font-size:12.5px; }

/* Prawa — rekomendowane / wyniki */
.gl-so-right{ min-width:0; }
.gl-so-right-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.gl-so-seeall{
  font-size:13px; font-weight:600; color:var(--red); text-decoration:none; white-space:nowrap;
}
.gl-so-seeall:hover{ color:var(--red-dark); text-decoration:underline; }

.gl-so-carousel{ position:relative; }
.gl-so-track{
  display:flex; gap:14px; overflow-x:auto; scroll-behavior:smooth;
  padding:4px 2px 10px; scrollbar-width:thin;
  min-height:120px;
}
.gl-so-track::-webkit-scrollbar{ height:6px; }
.gl-so-track::-webkit-scrollbar-thumb{ background:var(--gray-300); border-radius:999px; }
.gl-so-track.is-loading{ opacity:.5; pointer-events:none; }

.gl-so-empty, .gl-so-noresults{
  color:var(--gray-500); font-size:14px; padding:34px 4px;
}
.gl-so-noresults .gl-so-nr-term{ color:var(--gray-900); font-weight:600; }

/* Karta produktu — nawiązanie do głównej karty sklepu (.pcard) */
.gl-so-card{
  flex:0 0 172px; width:172px;
  border:1px solid var(--gray-300); border-radius:var(--rlg);
  overflow:hidden; text-decoration:none; color:var(--black);
  background:#fff; transition:box-shadow var(--t), transform var(--t);
  display:flex; flex-direction:column;
}
.gl-so-card:hover{ box-shadow:var(--shl,0 10px 28px rgba(0,0,0,.12)); transform:translateY(-4px); }
.gl-so-card-img{
  position:relative; aspect-ratio:1/1; background:#fff;
  border-bottom:1px solid var(--gray-100);
  display:flex; align-items:center; justify-content:center; overflow:hidden;
}
.gl-so-card-img img{ width:100%; height:100%; object-fit:contain; padding:12px; transition:transform .3s; }
.gl-so-card:hover .gl-so-card-img img{ transform:scale(1.05); }
.gl-so-card-badge{
  position:absolute; top:10px; left:10px; z-index:1;
  background:var(--red); color:#fff; font-size:11px; font-weight:800;
  padding:3px 9px; border-radius:999px;
}
.gl-so-card-body{ padding:13px 13px 14px; display:flex; flex-direction:column; gap:4px; }
.gl-so-card-brand{ font-size:11px; font-weight:600; color:var(--gray-500); text-transform:uppercase; letter-spacing:.3px; }
.gl-so-card-title{
  font-size:13.5px; line-height:1.35; color:var(--black); font-weight:300;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  min-height:37px;
}
.gl-so-card-price{ font-size:15px; font-weight:500; color:var(--black); margin-top:3px; }
.gl-so-card-price del{ color:var(--gray-500); font-weight:300; font-size:12.5px; margin-right:5px; }
.gl-so-card-price ins{ color:var(--black); text-decoration:none; font-weight:500; }
.gl-so-card-price .woocommerce-Price-amount{ white-space:nowrap; }

/* Strzałki karuzeli */
.gl-so-nav{
  position:absolute; top:44%; transform:translateY(-50%); z-index:2;
  width:38px; height:38px; border-radius:50%;
  background:#fff; border:1px solid var(--gray-300); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 4px 12px rgba(0,0,0,.12); transition:all var(--t);
}
.gl-so-nav:hover{ border-color:var(--red); color:var(--red); }
.gl-so-nav:disabled{ opacity:.35; cursor:default; }
.gl-so-nav svg{ width:20px; height:20px; stroke:currentColor; stroke-width:2; fill:none; }
.gl-so-prev{ left:-8px; }
.gl-so-next{ right:-8px; }

/* ===== Responsywność ===== */
@media (max-width:768px){
  .gl-so-inner{ max-height:100vh; min-height:100vh; }
  .gl-so-top{ padding:14px 16px; gap:8px; }
  .gl-so-input{ font-size:15px; }
  .gl-so-recent{ padding:0 16px 12px; }
  .gl-so-body{
    grid-template-columns:1fr; gap:10px;
    padding:6px 16px 40px;
  }
  .gl-so-left{ order:2; border-top:1px solid var(--gray-100); padding-top:6px; }
  .gl-so-right{ order:1; }
  .gl-so-card{ flex:0 0 150px; width:150px; }
  .gl-so-nav{ display:none !important; }
}
