
/* OPD Live Search (Free) */
.opd-ls{
  width: 100%;
  display: block;
  position: relative;
  z-index: var(--opd-ls-z, 9999);
}

.opd-ls__inner{
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 12px;
}

.opd-ls__form{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.opd-ls__input{
  flex: 1;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.18);
  background: rgba(255,255,255,.92);
  outline: none;
  font-size: 15px;
}

.opd-ls__input:focus{
  border-color: rgba(0,0,0,.35);
  background: #fff;
}

.opd-ls__btn{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.18);
  background: rgba(255,255,255,.92);
  cursor: pointer;
}

.opd-ls__icon{
  font-size: 16px;
  line-height: 1;
}

.opd-ls__dropdown{
  margin-top: 8px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.14);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0,0,0,.12);
}

.opd-ls__results{ display:block; }

.opd-ls__item{
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.opd-ls__item:last-child{ border-bottom: 0; }

.opd-ls__thumb{
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0,0,0,.06);
}

.opd-ls__meta{
  flex: 1;
  min-width: 0;
}

.opd-ls__title{
  font-size: 14px;
  line-height: 1.25;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opd-ls__price{
  font-size: 13px;
  opacity: .86;
}

.opd-ls__empty{
  padding: 12px;
  opacity: .75;
  font-size: 14px;
}

.opd-ls__viewall{
  display: block;
  padding: 10px 12px;
  font-size: 14px;
  text-decoration: none;
  border-top: 1px solid rgba(0,0,0,.08);
}

/* Desktop/tablet: centered bar inside header */
@media (min-width: 768px){
  .opd-ls__inner{ padding: 10px 14px; }
  .opd-ls__input{ padding: 13px 16px; border-radius: 16px; }
  .opd-ls__btn{ border-radius: 16px; }
}

/* Mobile: full width line */
@media (max-width: 767px){
  .opd-ls__inner{
    max-width: 100%;
    padding: 8px 10px;
  }
  .opd-ls__input{ border-radius: 16px; }
  .opd-ls__btn{ border-radius: 16px; }
}

/* Optional sticky on mobile */
.opd-ls--mobile-sticky{
  position: relative;
}
@media (max-width: 767px){
  .opd-ls--mobile-sticky{
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,.65);
    border-bottom: 1px solid rgba(0,0,0,.06);
  }
}


/* === OPD Live Search: header center slot === */
.opd-ls-header-center{
  flex: 1 1 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:0;
}

/* keep search on same header line, Temu-ish width */
.opd-ls{
  width: min(720px, 100%);
  max-width: 720px;
}

/* Search box */
.opd-ls__form{
  width:100%;
  position:relative;
  display:flex;
  align-items:center;
  gap:.5rem;
}
.opd-ls__input{
  width:100%;
  border:1px solid rgba(0,0,0,.18);
  border-radius: 999px;
  padding: .55rem .9rem;
  padding-right: 2.4rem;
  outline:none;
}
.opd-ls__btn{
  position:absolute;
  right:.35rem;
  top:50%;
  transform:translateY(-50%);
  width:34px;
  height:34px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.18);
  background:#fff;
  cursor:pointer;
}

/* Dropdown suggestions (no images) */
.opd-ls__dropdown{
  position:absolute;
  left:0;
  right:0;
  top: calc(100% + 8px);
  background:#fff;
  border:1px solid rgba(0,0,0,.12);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.10);
  overflow:hidden;
  display:none;
  z-index:9999;
}

.opd-ls__item{
  display:flex;
  align-items:center;
  gap:.6rem;
  padding:.55rem .8rem;
  text-decoration:none;
  color:#111;
  font-size:14px;
  line-height:1.2;
}
.opd-ls__item:hover{
  background: rgba(0,0,0,.04);
}
.opd-ls__icon{ opacity:.6; }
.opd-ls__label{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Mobile: whole top line is search (ONLY when search is actually mounted) */
@media (max-width: 720px){
  .opd-ls-mounted .header .header-left,
  .opd-ls-mounted .header .header-right{
    display:none !important;
  }
  .opd-ls-header-center{ justify-content:stretch; }
  .opd-ls{ max-width: 100%; }
}

/* Ensure the dropdown toggles correctly (we use [hidden]) */
.opd-ls__dropdown[hidden]{ display:none !important; }
.opd-ls__dropdown:not([hidden]){ display:block; }

/* Temu-like completion list */
.opd-ls-dd{position:absolute;top:calc(100% + 8px);left:0;right:0;background:#fff;border:1px solid rgba(0,0,0,.12);border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.12);z-index:9999;overflow:hidden}
.opd-ls-item{display:flex;gap:10px;align-items:center;padding:10px 12px;cursor:pointer}
.opd-ls-item:hover{background:rgba(0,0,0,.04)}
.opd-ls-ico{width:18px;opacity:.75}
.opd-ls-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}


/* OPD TEMU CENTERING */

/* Ensure header can layout left-center-right */
@media (min-width: 721px){
  .header .header-inner,
  header .header-inner,
  #masthead,
  .site-header{
    display:flex;
    align-items:center;
    gap: 12px;
  }

  /* Center slot that plugin creates */
  [data-opd-ls-slot="center"]{
    flex: 1 1 auto !important;
    display:flex !important;
    justify-content:center !important;
    align-items:center !important;
    min-width: 240px;
  }

  /* Search component width and perfect centering */
  [data-opd-ls-slot="center"] .opd-ls{
    width: 100% !important;
    max-width: 720px !important;
    margin: 0 auto !important;
  }

  /* Keep left/right from squeezing center too much */
  .header-left, .header-right{
    flex: 0 0 auto;
  }
}


/* Temu-style recent searches */
.opd-ls__sec{ padding: 10px 12px; }
.opd-ls__sec-h{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.opd-ls__sec-t{ font-size:14px; font-weight:600; opacity:.9; }
.opd-ls__sec-clear{
  border:0; background:transparent; cursor:pointer;
  font-size:16px; line-height:1; padding:6px 8px; border-radius:10px;
}
.opd-ls__sec-clear:hover{ background: rgba(0,0,0,.06); }

.opd-ls__chips{ display:flex; flex-wrap:wrap; gap:10px; }
.opd-ls__chip{
  border:1px solid rgba(0,0,0,.12);
  background: rgba(0,0,0,.03);
  border-radius: 999px;
  padding: 8px 12px;
  display:inline-flex; align-items:center; gap:8px;
  cursor:pointer;
  max-width: 100%;
}
.opd-ls__chip:hover{ background: rgba(0,0,0,.06); }
.opd-ls__chip-ico{ font-size:14px; opacity:.85; }
.opd-ls__chip-t{
  font-size:14px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 320px;
}
.opd-ls__chip-x{
  margin-left: 2px;
  font-size:18px;
  line-height:1;
  opacity:.65;
}
.opd-ls__chip-x:hover{ opacity:1; }
