/* ======================================================
   Live Search Autocomplete Dropdown
   ====================================================== */

.header_search {
  position: relative;
  overflow: visible; /* override style.css overflow:hidden so the dropdown isn't clipped */
}

.search-autocomplete {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  overflow: hidden;
  display: none;
}

.search-autocomplete.is-open {
  display: block;
}

/* ---- Result list ---- */
.sa-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}

.sa-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.sa-item:hover,
.sa-item.is-focused {
  background: #f7f8fa;
}

/* ---- Thumbnail ---- */
.sa-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 0px;
  overflow: hidden;
  background: #f1f3f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ---- Text ---- */
.sa-info {
  flex: 1;
  min-width: 0;
}

.sa-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1a202c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sa-price {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 2px;
  display: block;
  margin-top: 7px;
}

.sa-price del {
  color: #aab0ba;
  margin-right: 4px;
}

.sa-price ins {
  text-decoration: none;
  color: #e53e3e;
}

/* ---- States ---- */
.sa-empty,
.sa-loading {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: #718096;
  text-align: center;
}

.sa-loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #cbd5e0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: sa-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes sa-spin {
  to { transform: rotate(360deg); }
}

/* ---- View all link ---- */
.sa-view-all {
  display: block;
  padding: 10px 14px;
  border-top: 1px solid #edf2f7;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #000;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease;
}

.sa-view-all:hover {
  text-decoration: underline;
}
/* .search  input[type="search"]{
  -webkit-appearance: none !important;
  appearance: none !important;
} */
.header_search  input[type="search"]::-webkit-search-cancel-button {
 -webkit-appearance: none !important;
}
/* ======================================================
   Mobile Search Overlay
   ====================================================== */

.mobile-search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10000;
  align-items: flex-start;
}

.mobile-search-overlay.is-open {
  display: flex;
}

.mobile-search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  padding: 12px 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: visible;
}

.mobile-search-form {
  flex: 1;
  position: relative;
  overflow: visible;
}

/* ensure autocomplete dropdown isn't clipped inside the overlay */
.mobile-search-inner .search-autocomplete {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: -56px; /* extend past the close button */
  z-index: 10001;
}

.mobile-search-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #4a5568;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.mobile-search-close svg {
  width: 20px;
  height: 20px;
  display: block;
}

.mobile-search-close:hover {
  background: #f1f5f9;
}

/* ======================================================
   Search Results Page
   ====================================================== */

.search-results-page {
  padding: 48px 0 80px;
}

.search-results-inner {
  max-width: 1164px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ---- */
.search-results-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border-light, #e2e8f0);
}

.srh-title {
  font-size: var(--fs-30, 30px);
  font-weight: var(--fw-bold, 700);
  color: var(--color-heading-dark, #192d3b);
  margin: 0 0 6px;
  line-height: 1.2;
}

.srh-query {
  color: var(--color-accent-red, #ea2b0f);
}

.srh-count {
  font-size: var(--fs-14, 14px);
  color: var(--color-text-muted, #4d6474);
  margin: 0;
}

/* ---- Product grid (wrapping, not horizontal scroll) ---- */
.search-products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-product-item {
  display: flex;
  flex-direction: column;
}

.search-product-item .product-card {
  flex: 1;
}

/* ---- Generic (non-product) card fallback ---- */
.search-generic-card {
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
}

.sgc-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.sgc-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-bg-soft, #f6fafd);
}

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

.sgc-body {
  padding: 16px;
  flex: 1;
}

.sgc-title {
  font-size: var(--fs-16, 16px);
  font-weight: var(--fw-semibold, 600);
  margin: 0 0 8px;
  color: var(--color-heading-dark, #192d3b);
  line-height: 1.3;
}

.sgc-excerpt {
  font-size: var(--fs-14, 14px);
  color: var(--color-text-muted, #4d6474);
  margin: 0;
  line-height: 1.6;
}

/* ---- Pagination ---- */
.search-pagination {
  margin-top: 48px;
  display: flex;
  justify-content: center;
}

.search-pagination .nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.search-pagination .page-numbers {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-light, #e2e8f0);
  font-size: var(--fs-14, 14px);
  font-weight: var(--fw-medium, 500);
  color: var(--color-heading-dark, #192d3b);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  padding: 0 8px;
}

.search-pagination .page-numbers:hover {
  background: var(--color-bg-soft, #f6fafd);
  border-color: var(--color-border-strong, #626262);
}

.search-pagination .page-numbers.current {
  background: var(--color-black, #000);
  border-color: var(--color-black, #000);
  color: var(--color-white, #fff);
}

.search-pagination .page-numbers.dots {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.search-pagination .page-numbers svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  display: block;
}

/* ---- No Results ---- */
header .search-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  gap: 16px;
}

.snr-icon {
  width: 72px;
  height: 72px;
  background: var(--color-bg-soft, #f6fafd);
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted, #4d6474);
}

.snr-icon svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  fill: none;
}

.snr-title {
  font-size: var(--fs-28, 28px);
  font-weight: var(--fw-bold, 700);
  color: var(--color-heading-dark, #192d3b);
  margin: 0;
}

.snr-text {
  font-size: var(--fs-16, 16px);
  color: var(--color-text-muted, #4d6474);
  margin: 0;
  max-width: 420px;
  line-height: 1.6;
}

.snr-form {
  display: flex;
  height: 50px;
  max-width: 480px;
  width: 100%;
  background: var(--color-white, #fff);
  border: 1px solid var(--color-border-strong, #626262);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.08);
  margin-top: 8px;
}

.snr-form input[type="search"] {
  flex: 1;
  border: none;
  outline: none;
  padding: 0 16px;
  font-size: var(--fs-14, 14px);
  font-family: inherit;
  color: var(--color-text, #000);
  background: transparent;
}

.snr-form input[type="search"]::placeholder {
  color: var(--color-text-muted, #4d6474);
}

.snr-form button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  background: var(--color-black, #000);
  color: var(--color-white, #fff);
  font-size: var(--fs-14, 14px);
  font-weight: var(--fw-medium, 500);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.snr-form button:hover {
  background: #222;
}

.snr-form button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

/* ======================================================
   Search Results Page — Responsive
   ====================================================== */

@media (max-width: 1100px) {
  .search-products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 820px) {
  .search-results-page {
    padding: 32px 0 60px;
  }

  .srh-title {
    font-size: var(--fs-20, 20px);
  }

  .search-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .search-results-inner {
    padding: 0 16px;
  }

  .search-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .snr-form {
    flex-direction: column;
    height: auto;
    box-shadow: none;
  }

  .snr-form input[type="search"] {
    height: 48px;
    border-bottom: 1px solid var(--color-border-light, #e2e8f0);
  }

  .snr-form button {
    height: 48px;
    justify-content: center;
  }
}
