.lipha-search-autocomplete {
  position: absolute;
  z-index: 99999;
  max-height: min(520px, calc(100vh - 110px));
  overflow: auto;
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  font-size: 14px;
  overscroll-behavior: contain;
}

.lipha-search-autocomplete__header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e5e7eb;
}

.lipha-search-autocomplete__heading {
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
}

.lipha-search-autocomplete__view-all,
.lipha-search-autocomplete__footer {
  color: #0f766e;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.lipha-search-autocomplete__group {
  padding: 10px 12px 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lipha-search-autocomplete__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 10px 12px;
  color: #111827;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  cursor: pointer;
}

.lipha-search-autocomplete__thumb {
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.lipha-search-autocomplete__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lipha-search-autocomplete__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.lipha-search-autocomplete__badge,
.lipha-search-card__badge {
  width: fit-content;
  max-width: 100%;
  padding: 2px 7px;
  color: #0f766e;
  background: #e6f5f3;
  border: 1px solid #bfe3dd;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lipha-search-autocomplete__title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: #111827;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.32;
}

.lipha-search-autocomplete__meta {
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lipha-search-autocomplete__item:hover,
.lipha-search-autocomplete__item:focus {
  outline: none;
  background: #f7fafc;
}

.lipha-search-autocomplete__item:active {
  background: #e6f5f3;
}

.lipha-search-autocomplete__footer {
  display: none;
  padding: 12px;
  text-align: center;
  border-top: 1px solid #e5e7eb;
}

.lipha-search-results {
  width: min(1440px, calc(100% - 32px));
  margin: 20px auto;
  color: #111827;
}

.lipha-search-results__status,
.lipha-search-results__empty {
  padding: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.lipha-search-results__head h2,
.lipha-search-results__empty h2 {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.3;
}

.lipha-search-results__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.lipha-search-results__count {
  color: #64748b;
  font-size: 13px;
  white-space: nowrap;
}

.lipha-search-results__layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.lipha-search-results__facets {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.lipha-search-facet + .lipha-search-facet {
  margin-top: 14px;
}

.lipha-search-facet__title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.lipha-search-facet__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  color: #475569;
  font-size: 13px;
}

.lipha-search-results__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
}

.lipha-search-card {
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.lipha-search-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.lipha-search-card__image {
  display: block;
  aspect-ratio: 1 / 1;
  background: #f8fafc;
}

.lipha-search-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.lipha-search-card__body {
  padding: 12px;
}

.lipha-search-card h3 {
  margin: 7px 0 0;
  font-size: 14px;
  line-height: 1.35;
}

.lipha-search-card h3 a {
  color: #111827;
  text-decoration: none;
}

.lipha-search-card__meta {
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.lipha-search-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 20px 0 4px;
}

.lipha-search-pagination button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.lipha-search-pagination button:hover:not(:disabled),
.lipha-search-pagination button.is-active {
  color: #fff;
  background: #0f766e;
  border-color: #0f766e;
}

.lipha-search-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lipha-search-results__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.lipha-search-results__chips a,
.lipha-search-results__rfq,
.lipha-search-widget__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  text-decoration: none;
}

.lipha-search-results__chips a {
  color: #334155;
  background: #f8fafc;
}

.lipha-search-results__rfq,
.lipha-search-widget__button {
  color: #fff;
  background: #0f766e;
  border-color: #0f766e;
}

.lipha-search-widget__form {
  display: flex;
  gap: 8px;
  width: 100%;
}

.lipha-search-widget__input {
  flex: 1 1 auto;
  min-width: 0;
}

.lipha-search-native-hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .lipha-search-results {
    width: min(100% - 20px, 1180px);
  }

  .lipha-search-results__layout {
    grid-template-columns: 1fr;
  }

  .lipha-search-results__facets {
    display: none;
  }

  .lipha-search-results__grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .lipha-search-card {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .lipha-search-card__image {
    height: 100%;
    min-height: 104px;
  }

  .lipha-search-card__body {
    padding: 10px;
  }

  .lipha-search-card h3 {
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .lipha-search-autocomplete {
    max-height: min(78vh, 560px);
    border-radius: 10px;
  }

  .lipha-search-autocomplete__view-all {
    display: none;
  }

  .lipha-search-autocomplete__footer {
    display: block;
  }

  .lipha-search-autocomplete__item {
    min-height: 82px;
    padding: 11px 10px;
  }

  .lipha-search-autocomplete__thumb {
    flex-basis: 64px;
    width: 64px;
    height: 64px;
  }

  .lipha-search-autocomplete__title {
    font-size: 14px;
  }

  .lipha-search-widget__form {
    gap: 6px;
  }

  .lipha-search-widget__button {
    min-width: 54px;
    padding-inline: 10px;
  }
}

/* Federated Search & Category Scope Layout (v0.2.0) */
/* v0.3.0 FIX: the old rule below absolutely positioned .lipha-search-category-scope
   over the whole search input (the reported "dropdown covers keyword box" bug).
   The class is now styling-neutral by default and only re-positioned inside the
   plugin's own shortcode widget form. */
.lipha-search-widget__form .lipha-search-category-scope {
  flex: 0 0 auto;
  max-width: 220px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #333;
  padding: 8px 10px;
  outline: none;
  font-size: 13px;
  cursor: pointer;
}

.lipha-search-widget__form {
  position: relative;
  display: flex;
}

.lipha-search-autocomplete__container {
  display: flex;
  flex-direction: row;
  width: 100%;
}

.lipha-search-autocomplete__federated {
  width: 35%;
  min-width: 150px;
  border-right: 1px solid #eee;
  padding: 10px;
  background: #fcfcfc;
}

.lipha-search-autocomplete__group-title {
  font-size: 11px;
  text-transform: uppercase;
  color: #888;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  margin-top: 10px;
}

.lipha-search-autocomplete__federated ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.lipha-search-autocomplete__federated li {
  margin-bottom: 6px;
}

.lipha-search-autocomplete__federated a {
  color: #333;
  text-decoration: none;
  font-size: 13px;
  display: block;
  padding: 4px 8px;
  border-radius: 3px;
  transition: background 0.2s;
}

.lipha-search-autocomplete__federated a:hover {
  background: #eef4fc;
  color: #0b5fb5;
}

.lipha-search-autocomplete__list {
  flex: 1;
  max-height: 400px;
  overflow-y: auto;
}

.lipha-search-autocomplete__full-width {
  width: 100%;
}

@media (max-width: 768px) {
  .lipha-search-autocomplete__container {
    flex-direction: column;
  }
  .lipha-search-autocomplete__federated {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #eee;
  }
}

/* ============================================================
   v0.3.0 - Lipha Lightning Search navbar (ELS-compatible UI)
   Mirrors Electro Lightning Search layout on khotieudung.com.
   ============================================================ */
:root {
  --lpls-primary: #0d1b6e;
  --lpls-primary-dark: #091254;
  --lpls-border: #e0e4f0;
  --lpls-text: #1a1a2e;
  --lpls-muted: #6b7280;
  --lpls-hover: #f5f7ff;
  --lpls-radius: 10px;
  --lpls-transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.lipha-ls-wrapper {
  position: relative;
  z-index: 9999;
  flex: 1;
  min-width: 0;
}

.lipha-ls-form { width: 100%; margin: 0; }

.lipha-ls-input-group {
  display: flex;
  align-items: stretch;
  border: 2px solid var(--lpls-primary);
  border-radius: var(--lpls-radius);
  background: #fff;
  overflow: hidden;
  transition: box-shadow var(--lpls-transition), border-color var(--lpls-transition);
  height: 46px;
}

.lipha-ls-wrapper.lipha-ls-open .lipha-ls-input-group,
.lipha-ls-input-group:focus-within {
  box-shadow: 0 0 0 3px rgba(13, 27, 110, 0.18);
  border-color: var(--lpls-primary);
}

.lipha-ls-input-field {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.lipha-ls-input {
  width: 100%;
  height: 100%;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 36px 0 16px !important;
  font-size: 14px;
  color: var(--lpls-text);
  background: transparent !important;
  font-family: inherit;
  line-height: 1;
  margin: 0;
}

.lipha-ls-input::placeholder { color: #9ca3af; font-size: 13.5px; }

.lipha-ls-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 50%;
  transition: color var(--lpls-transition), background var(--lpls-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lipha-ls-clear:hover { color: var(--lpls-text); background: #f0f0f0; }

.lipha-ls-categories {
  display: flex;
  align-items: center;
  border-left: 1px solid var(--lpls-border);
  background: #f8f9ff;
  flex-shrink: 0;
}

.lipha-ls-category-select {
  height: 100%;
  border: none !important;
  outline: none !important;
  background: transparent;
  padding: 0 30px 0 12px;
  font-size: 13px;
  color: var(--lpls-text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 120px;
  max-width: 160px;
  font-family: inherit;
  position: static !important;
}

.lipha-ls-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  min-width: 52px;
  background: var(--lpls-primary);
  border: none;
  cursor: pointer;
  transition: background var(--lpls-transition);
  color: #fff;
  padding: 0;
  flex-shrink: 0;
  border-radius: 0;
}

.lipha-ls-btn:hover { background: var(--lpls-primary-dark); color: #fff; }
.lipha-ls-btn svg { display: block; }

/* Autocomplete dropdown rendered by the plugin under the wrapper */
.lipha-ls-wrapper .lipha-search-autocomplete {
  position: absolute !important;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: auto !important;
  background: #fff;
  border-radius: var(--lpls-radius);
  box-shadow: 0 8px 32px rgba(13, 27, 110, 0.12), 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid var(--lpls-border);
  animation: lpls-dropdown-appear 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes lpls-dropdown-appear {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lipha-ls-wrapper .lipha-search-autocomplete__item:hover,
.lipha-ls-wrapper .lipha-search-autocomplete__item:focus {
  background: var(--lpls-hover);
}

@media (max-width: 992px) {
  .lipha-ls-categories { display: none; }
}

@media (max-width: 576px) {
  .lipha-ls-wrapper .lipha-search-autocomplete {
    position: fixed !important;
    top: auto;
    left: 0 !important;
    right: 0;
    bottom: 0;
    width: 100% !important;
    border-radius: var(--lpls-radius) var(--lpls-radius) 0 0;
    max-height: 80vh;
  }
}

/* v0.3.1 hotfix - khotieudung autocomplete hover visibility
   Prevent theme/legacy menu CSS from forcing black hover background on product suggestions. */
.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item,
.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:link,
.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:visited {
  background: #fff !important;
  color: #1a1a2e !important;
}

.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:hover,
.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:focus,
.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:active {
  background: #f5f7ff !important;
  color: #0d1b6e !important;
  outline: none !important;
}

.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:hover *,
.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:focus *,
.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:active * {
  color: inherit !important;
}

.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:hover .lipha-search-autocomplete__meta,
.lipha-ls-wrapper .lipha-search-autocomplete .lipha-search-autocomplete__item:focus .lipha-search-autocomplete__meta {
  color: #4b5563 !important;
}

/* v0.3.2 hotfix - khotieudung departments title visibility
   Keep the Electro departments trigger readable on a white header and hover state. */
.departments-menu-v2-title,
.departments-menu-v2-title:link,
.departments-menu-v2-title:visited,
.departments-menu-v2 .departments-menu-v2-title,
.header-v6 .departments-menu-v2 .departments-menu-v2-title,
.electro-navbar .departments-menu-v2 .departments-menu-v2-title {
  color: #1a1a2e !important;
  background: #fff !important;
}

.departments-menu-v2-title:hover,
.departments-menu-v2-title:focus,
.departments-menu-v2-title:active,
.departments-menu-v2.show .departments-menu-v2-title,
.departments-menu-v2 .departments-menu-v2-title:hover,
.departments-menu-v2 .departments-menu-v2-title:focus,
.header-v6 .departments-menu-v2 .departments-menu-v2-title:hover,
.header-v6 .departments-menu-v2 .departments-menu-v2-title:focus,
.electro-navbar .departments-menu-v2 .departments-menu-v2-title:hover,
.electro-navbar .departments-menu-v2 .departments-menu-v2-title:focus {
  color: #0d1b6e !important;
  background: #f5f7ff !important;
}

.departments-menu-v2-title *,
.departments-menu-v2-title:hover *,
.departments-menu-v2-title:focus *,
.departments-menu-v2-title:active * {
  color: inherit !important;
}
