/**
 * Hello Retail Live Search — search.css
 * Layout:
 * - Wide overlay panel (up to 1400px)
 * - Two-column body: category sidebar (left) + max 4-column product grid (right)
 * - Scrollable independently — sidebar shows ALL categories
 * - Dark "See all" footer bar, pinned at bottom
 */

/* ── Box-sizing reset ─────────────────────────────────────────────────────── */
.hrs-search-wrap,
.hrs-search-wrap *,
.hrs-search-wrap *::before,
.hrs-search-wrap *::after {
  box-sizing: border-box;
}

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.hrs-search-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

/* ── Input row ────────────────────────────────────────────────────────────── */
.hrs-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.hrs-icon-search {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.hrs-search-input {
  width: 100%;
  /* !important needed on height and vertical padding: Elementor themes often
     set their own padding-top / height on search inputs with high specificity.
     Without !important those overrides push the text to the top of the box. */
  height: 46px !important;
  padding: 0 42px 0 44px !important;
  border: 1.5px solid #d8d8d8;
  border-radius: 28px;
  background: #fff;
  color: #111;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 0.03em;
  outline: none;
  line-height: normal;
  vertical-align: middle;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.hrs-search-input::placeholder {
  color: #aaa;
  letter-spacing: 0.05em;
}

.hrs-search-input:focus {
  border-color: #bbb;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.hrs-search-input::-webkit-search-cancel-button {
  display: none;
}

.hrs-clear-btn {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  background: #ebebeb;
  border: none;
  padding: 0;
  width: 22px;
  height: 22px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}

.hrs-clear-btn:hover {
  background: #d8d8d8;
  color: #111;
}

/* ── Dropdown panel ───────────────────────────────────────────────────────── */

/* .hrs-results uses display:flex, which outranks the UA stylesheet's
   [hidden]{display:none} rule. This selector restores the hidden behaviour. */
.hrs-results[hidden] {
  display: none !important;
}

.hrs-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max(100%, min(1400px, 96vw));
  z-index: 9999;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 14px;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.18), 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  max-height: 700px;
  /* Flex column: body grows to fill, footer stays at bottom */
  display: flex;
  flex-direction: column;
}

/* ── Fuzzy fallback notice (full-width, above the two columns) ────────────── */
.hrs-fallback-notice {
  padding: 6px 14px;
  margin: 0;
  font-size: 12px;
  font-style: italic;
  color: #888;
  background: #f8f8f8;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.hrs-fallback-notice strong {
  font-style: normal;
  color: #555;
}

/* ── Two-column panel body ────────────────────────────────────────────────── */
.hrs-panel-body {
  display: flex;
  flex: 1;
  min-height: 0;    /* critical: lets children scroll inside a flex parent */
  overflow: hidden;
}

/* ── Left column — product grid ───────────────────────────────────────────── */
.hrs-grid-col {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

/* ── Left column — category sidebar ──────────────────────────────────────── */
.hrs-cats-sidebar {
  width: 195px;
  flex-shrink: 0;
  order: -1;                        /* renders before .hrs-grid-col */
  border-right: 1px solid #f0f0f0;
  background: #fafafa;
  overflow-y: auto;
  padding: 12px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.hrs-cats-title {
  font-size: 10px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 8px 10px;
}

/* Category buttons inside the sidebar — full-width, pill-less */
.hrs-cats-sidebar .hrs-cat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #555;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  white-space: normal;
  line-height: 1.35;
  transition: background 0.1s, color 0.1s;
}

.hrs-cats-sidebar .hrs-cat-btn:hover {
  background: #efefef;
  color: #111;
}

.hrs-cats-sidebar .hrs-cat-btn--active {
  background: #111;
  color: #fff;
  font-weight: 600;
}

.hrs-cats-sidebar .hrs-cat-btn--active:hover {
  background: #333;
}

/* Category name — truncates so the count always sits flush on the right */
.hrs-cats-sidebar .hrs-cat-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hrs-cats-sidebar .hrs-cat-count {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.55;
  flex-shrink: 0;
  margin-left: 6px;
}

.hrs-cats-sidebar .hrs-cat-btn--active .hrs-cat-count {
  opacity: 0.7;
}

/* ── Product grid — max 4 columns ────────────────────────────────────────── */
.hrs-list {
  list-style: none;
  margin: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-content: start;
}

/* ── Product card ─────────────────────────────────────────────────────────── */
.hrs-item {
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #f0f0f0;
  background: #fff;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.hrs-item:hover,
.hrs-item--active {
  border-color: #d0d0d0;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
}

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

/* ── Product image area — white so images blend in ───────────────────────── */
.hrs-item-img-wrap {
  position: relative;
  background: #fff;
  height: 165px;
  flex-shrink: 0;
  overflow: hidden;
}

/* ── Sale ribbon ──────────────────────────────────────────────────────────── */
.hrs-sale-badge {
  position: absolute;
  top: 0;
  left: 0;
  background: #e03030;
  color: #fff;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 0 0 6px 0;
  z-index: 2;
  line-height: 1.2;
  pointer-events: none;
}

.hrs-item-img {
  display: block !important;
  position: absolute !important;
  top: 12px !important;
  left: 12px !important;
  width: calc(100% - 24px) !important;
  height: calc(100% - 24px) !important;
  object-fit: contain !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
}

.hrs-item-img--placeholder {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
}

/* ── Product body ─────────────────────────────────────────────────────────── */
.hrs-item-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.hrs-item-category {
  display: none;
}

.hrs-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hrs-item-price-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 4px;
}

.hrs-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
}

.hrs-item-price--sale {
  color: #e03030;
}

.hrs-item-old-price {
  font-size: 10.5px;
  color: #999;
  text-decoration: line-through;
  font-weight: 400;
}

.hrs-item-stock {
  font-size: 9.5px;
  font-weight: 600;
  color: #2a9c5a;
  margin-top: 2px;
}

/* ── Footer — dark "See all" bar, pinned at bottom ───────────────────────── */
.hrs-footer {
  background: #111;
  flex-shrink: 0;
}

.hrs-see-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: background 0.12s;
}

.hrs-see-all:hover {
  background: #222;
  color: #fff;
  text-decoration: none;
}

/* ── No-results message ───────────────────────────────────────────────────── */
.hrs-no-results {
  padding: 36px 24px;
  margin: 0;
  font-size: 14px;
  color: #888;
  text-align: center;
}

.hrs-no-results strong {
  color: #1a1a1a;
}

/* ── Did-you-mean suggestion ──────────────────────────────────────────────── */
.hrs-suggestion {
  padding: 0 24px 28px;
  margin: 0;
  font-size: 14px;
  color: #888;
  text-align: center;
}

.hrs-suggestion-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: #1a1a1a;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.hrs-suggestion-link:hover {
  opacity: 0.6;
}

/* ── Loading spinner ──────────────────────────────────────────────────────── */
.hrs-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 48px 20px;
}

.hrs-spinner span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a1a1a;
  animation: hrs-bounce 0.8s infinite ease-in-out both;
}

.hrs-spinner span:nth-child(1) { animation-delay: -0.32s; }
.hrs-spinner span:nth-child(2) { animation-delay: -0.16s; }
.hrs-spinner span:nth-child(3) { animation-delay: 0s; }

@keyframes hrs-bounce {
  0%, 80%, 100% { transform: scale(0.55); opacity: 0.35; }
  40%            { transform: scale(1);   opacity: 1; }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hrs-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .hrs-cats-sidebar {
    width: 160px;
  }
}

@media (max-width: 640px) {
  .hrs-search-wrap {
    max-width: 100%;
  }

  .hrs-results {
    left: -12px;
    right: -12px;
    width: auto;
    transform: none;
  }

  /* On narrow screens the sidebar collapses — categories shown above grid */
  .hrs-panel-body {
    flex-direction: column;
  }

  .hrs-cats-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #f0f0f0;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px 10px;
    max-height: 80px;
    overflow-y: auto;
    gap: 4px;
  }

  .hrs-cats-title {
    display: none;
  }

  .hrs-cats-sidebar .hrs-cat-btn {
    width: auto;
    border: 1.5px solid #e0e0e0;
    border-radius: 20px;
    padding: 4px 10px;
    white-space: nowrap;
  }

  .hrs-cats-sidebar .hrs-cat-btn--active {
    background: #111;
    color: #fff;
    border-color: #111;
  }

  .hrs-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 380px) {
  .hrs-list {
    grid-template-columns: 1fr 1fr;
  }
}
