/* --------------------------------------------------------------------------
   P-Clips Header Live Search — Clean + Header-safe (v1.5)
   Goals:
   - Wider search bar without squeezing other header elements
   - Right aligned, tight to basket/account
   - Figtree everywhere inside component
   - Input: #F4F4F4, no borders, no shadows
   - Pills: no borders, no shadows
   -------------------------------------------------------------------------- */

body.pclips-hsearch-lock {
  overflow: hidden !important;
}

/* ====== DESIGN TOKENS ===================================================== */
.pclips-hsearch {
  --pclips-blue: #0b57d0;
  --pclips-text: rgba(0, 0, 0, 0.86);
  --pclips-muted: rgba(0, 0, 0, 0.60);
  --pclips-border: rgba(0, 0, 0, 0.10);

  --pclips-surface: #ffffff;
  --pclips-surface-2: #f6f8fb;
  --pclips-surface-3: #eef3ff;

  --pclips-radius: 12px;
  --pclips-radius-lg: 16px;

  --pclips-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);

  position: relative;
  font-family: Figtree, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Force Figtree everywhere inside the component */
.pclips-hsearch,
.pclips-hsearch * ,
.pclips-hsearch input,
.pclips-hsearch button {
  font-family: Figtree, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important;
}

/* =======================================================================
   HEADER LAYOUT (KEY FIX)
   Target your actual header container: .pclips-header__search
   - makes the search area right-aligned
   - allows it to be wider without forcing 100% width everywhere
   ======================================================================= */

/* The Elementor container that holds the shortcode (seen in your DevTools) */
.pclips-header__search {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;

  /* Allow it to be wide, but still shrink if header gets tight */
  flex: 1 1 560px !important;
  min-width: 260px !important;
  max-width: 560px !important;

  /* Tighten to the basket/account cluster */
  margin-left: auto !important;
  margin-right: 12px !important;
}

/* Elementor wrapper layers: do NOT let them force awkward widths */
.pclips-header__search .elementor-widget-container,
.pclips-header__search .elementor-shortcode {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}

/* Our component fills the allowed space (the container controls max width) */
.pclips-header__search .pclips-hsearch {
  width: 100% !important;
  max-width: 560px !important;
  min-width: 0 !important;
}

/* ====== INPUT WRAP ======================================================== */
.pclips-hsearch__wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;

  border: 0 !important;
  box-shadow: none !important;
  background: transparent;
}

/* ====== INPUT ============================================================= */
/* Override theme padding-left etc, and make it borderless + shadowless */
.pclips-hsearch input[type="search"].pclips-hsearch__input,
.pclips-hsearch__input {
  height: 50px;

  /* IMPORTANT: kills that theme 43px padding-left */
  /* room for submit + clear buttons */
  padding: 10px 78px 10px 14px !important;

  border: 0 !important;
  box-shadow: none !important;

  background: #F4F4F4 !important;
  border-radius: var(--pclips-radius) !important;

  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--pclips-text);

  outline: none;
  box-sizing: border-box;
  width: 100% !important;
  max-width: none !important;
}

.pclips-hsearch__input::placeholder {
  color: rgba(0, 0, 0, 0.25);
  font-weight: 500;
}

/* Focus: outline only (no border, no box-shadow) */
.pclips-hsearch__input:focus {
  /*outline: 2px solid rgba(11, 87, 208, 1) !important;
  outline-offset: 2px !important;*/
}

/* Clear button */
.pclips-hsearch__submit {
  position: absolute;
  right: 8px !important;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: rgba(0, 0, 0, 0.55) !important;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.pclips-hsearch__submit:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.72);
}

.pclips-hsearch__submit:active {
  transform: scale(0.96);
}

.pclips-hsearch__icon {
  display: inline-flex;
  line-height: 0;
}

.pclips-hsearch__clear {
  position: absolute;
  right: 44px !important;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: rgba(0, 0, 0, 0.55)!important;
  font-size: 1.2rem;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

/* Hide clear button until the user has typed something.
   JS toggles .has-value on the component for robust cross-browser behaviour. */
.pclips-hsearch:not(.has-value) .pclips-hsearch__clear {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}

.pclips-hsearch__clear:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.72);
}

.pclips-hsearch__clear:active {
  transform: scale(0.96);
}

/* ====== DROPDOWN ========================================================== */
.pclips-hsearch__dropdown {
  position: absolute;
  top: calc(44px + 10px);
  left: 0;
  right: 0;
  z-index: 99999;

  background: var(--pclips-surface);

  border: 1px solid var(--pclips-border);
  border-radius: var(--pclips-radius-lg) !important;
  box-shadow: var(--pclips-shadow);
  overflow: hidden;

  display: none;

  max-height: min(520px, 70vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Footer: “View all results …” */
.pclips-hsearch__footer{
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
}

.pclips-hsearch__viewall{
  display: block;
  font-weight: 600;
  text-decoration: none;
}

.pclips-hsearch__viewall:focus,
.pclips-hsearch__viewall:hover{
  text-decoration: underline;
}

.pclips-hsearch.is-open .pclips-hsearch__dropdown {
  display: block;
}

.pclips-hsearch__loading,
.pclips-hsearch__empty {
  padding: 14px 14px;
  font-size: 13px;
  color: var(--pclips-muted);
  font-weight: 600;
  background: var(--pclips-surface);
}

/* Result row */
.pclips-hsearch__item {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 20px 14px;

  text-decoration: none;
  color: inherit;

  background: var(--pclips-surface);
  border-top: 2px solid rgba(0,0,0,0.06);

  transition: background 200ms ease;
}

.pclips-hsearch__item:first-child {
  border-top: 0;
}

/* Full-height left accent + smooth 0.5s */
.pclips-hsearch__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--pclips-blue);
  opacity: 0;
  transform: translateX(-2px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.pclips-hsearch__item:hover {
  background: var(--pclips-surface-2);
}

.pclips-hsearch__item:hover::before {
  opacity: 1;
  transform: translateX(0);
}

/* Thumbnail */
.pclips-hsearch__thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--pclips-surface-2);
  display: grid;
  place-items: center;
}

.pclips-hsearch__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Meta */
.pclips-hsearch__meta {
  min-width: 0;
}

.pclips-hsearch__titleRow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pclips-hsearch__titleBlock {
  min-width: 0;
}

/* SKU above title */
.pclips-hsearch__sku {
  font-size: 12px;
  line-height: 1.15;
  color: rgba(0,0,0,0.60);
  font-weight: 600;
  letter-spacing: 0.2px;
  margin-bottom: 5px;
}

/* Title */
.pclips-hsearch__title {
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 800;
  color: var(--pclips-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Price */
.pclips-hsearch__price {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 900;
  color: rgba(0,0,0,0.72);
  white-space: nowrap;
}

/* Pills */
.pclips-hsearch__pills {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Flat pills: no borders, no shadows */
.pclips-hsearch__pill {
  font-size: 12px;
  line-height: 1;
  padding: 10px 10px;
  border-radius: 999px;
  background: #f5f5f5;
  border: 0 !important;
  box-shadow: none !important;
  color: rgba(0, 0, 0, 0.78);
  white-space: nowrap;
  font-weight: 700;
}

.pclips-hsearch__pilllabel {
  font-weight: 800;
  color: rgba(0, 0, 0, 0.75);
}

/* Scrollbar */
.pclips-hsearch__dropdown::-webkit-scrollbar {
  width: 10px;
}
.pclips-hsearch__dropdown::-webkit-scrollbar-track {
  background: transparent;
}
.pclips-hsearch__dropdown::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.14);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
.pclips-hsearch__dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.22);
  border: 3px solid transparent;
  background-clip: content-box;
}

/* Mobile */
@media (max-width: 768px) {
  .pclips-header__search {
    flex: 1 1 auto !important;
    max-width: 100% !important;
    margin-right: 10px !important;
  }

  .pclips-header__search .pclips-hsearch {
    max-width: 100% !important;
  }

  .pclips-hsearch__dropdown {
    top: calc(44px + 8px);
    border-radius: 14px !important;
    max-height: min(460px, 62vh);
  }

  .pclips-hsearch__item {
    grid-template-columns: 52px 1fr;
    padding: 12px 12px;
  }

  .pclips-hsearch__thumb {
    width: 52px;
    height: 52px;
    border-radius: 14px;
  }

  .pclips-hsearch__pills {
    gap: 7px;
  }

  .pclips-hsearch__pill {
    padding: 10px 10px;
  }
}



/* ====== PILL LABEL TWEAKS =============================================== */
.pclips-hsearch__pilllabel {
  font-weight: 800 !important;
  font-size: 1.1em !important;
  margin-right: 4px;
}

/* Inject colon after label */
.pclips-hsearch__pilllabel::after {
  content: ":";
  margin-left: 1px;
}

