/* ============================================================
   MARTAL — Search System
   search.css | Overlay + Results Page | Mobile-First RTL
   New selectors ONLY — all variables, buttons, typography,
   layout, and utility classes inherited from style.css / shop.css.
   ============================================================ */


/* ── 1. SEARCH OVERLAY ───────────────────────────────────────── */
.srch-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: start center;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-slow);
}

.srch-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Backdrop */
.srch-overlay__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 4, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 0;
  transition: opacity var(--t-slow);
}

/* Floating panel */
.srch-overlay__panel {
  position: relative;
  z-index: 1;
  width: min(680px, calc(100vw - 32px));
  margin-top: clamp(var(--sp-8), 10vh, 96px);
  background: var(--clr-surface);
  border-radius: var(--r-xl);
  box-shadow: 0 32px 80px rgba(0,0,0,0.22), 0 0 0 1px var(--clr-border);
  overflow: hidden;
  transform: translateY(-16px) scale(0.97);
  transition: transform var(--t-slow);
  max-height: calc(100vh - clamp(var(--sp-8), 10vh, 96px) - var(--sp-8));
  display: flex;
  flex-direction: column;
}

.srch-overlay.open .srch-overlay__panel {
  transform: translateY(0) scale(1);
}

/* Mobile: full-screen */
@media (max-width: 639px) {
  .srch-overlay__panel {
    width: 100vw;
    margin-top: 0;
    border-radius: 0;
    max-height: 100dvh;
    height: 100dvh;
  }
}


/* ── 2. INPUT ROW ─────────────────────────────────────────────── */
.srch-overlay__input-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--clr-border);
  background: var(--clr-surface);
  flex-shrink: 0;
}

.srch-overlay__icon {
  font-size: 20px;
  color: var(--clr-red);
  flex-shrink: 0;
}

.srch-overlay__input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  color: var(--clr-text);
  background: transparent;
  caret-color: var(--clr-red);
}

.srch-overlay__input::placeholder {
  color: var(--clr-light);
  font-weight: 400;
}

.srch-overlay__clear {
  font-size: 16px;
  color: var(--clr-muted);
  transition: color var(--t-fast), background var(--t-fast);
}

.srch-overlay__clear:hover {
  color: var(--clr-red);
  background: var(--clr-rose);
}

.srch-overlay__close {
  flex-shrink: 0;
  font-size: 13px;
}


/* ── 3. OVERLAY BODY (recent + trending) ─────────────────────── */
.srch-overlay__body {
  padding: var(--sp-5);
  overflow-y: auto;
  scrollbar-width: thin;
  flex: 1;
}

.srch-section {
  margin-bottom: var(--sp-6);
}

.srch-section:last-child {
  margin-bottom: 0;
}

.srch-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.srch-section__title {
  font-size: 12px;
  font-weight: 900;
  color: var(--clr-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.srch-section__title i {
  font-size: 14px;
}

.srch-section__action {
  font-size: 12px;
  font-weight: 700;
  color: var(--clr-muted);
  font-family: var(--font-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px var(--sp-2);
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}

.srch-section__action:hover {
  color: var(--clr-red);
  background: var(--clr-rose);
}


/* ── 4. RECENT SEARCHES ───────────────────────────────────────── */
.srch-recent-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.srch-recent-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.srch-recent-item__query {
  flex: 1;
  text-align: start;
}

.srch-recent-item__remove {
  font-size: 14px;
  color: var(--clr-light);
  opacity: 0;
  transition: opacity var(--t-fast), color var(--t-fast);
}

.srch-recent-item:hover .srch-recent-item__remove {
  opacity: 1;
}

.srch-recent-item__remove:hover {
  color: var(--clr-red);
}


/* ── 5. SEARCH PILLS ──────────────────────────────────────────── */
.srch-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--clr-rose);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--clr-text);
  cursor: pointer;
  font-family: var(--font-primary);
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.srch-pill:hover {
  background: var(--clr-nude);
  border-color: var(--clr-nude);
  color: var(--clr-red-deep);
  transform: translateY(-1px);
}

.srch-pill i {
  font-size: 14px;
  color: var(--clr-red);
}

.srch-pill--brand {
  background: #F0F5FF;
  border-color: #C8D8FF;
  color: #2A4A9A;
}

.srch-pill--brand i { color: #2A4A9A; }
.srch-pill--brand:hover { background: #D8E5FF; }

.srch-pill--color {
  background: var(--clr-beige);
  border-color: var(--clr-nude);
}


/* ── 6. TRENDING LIST ─────────────────────────────────────────── */
.srch-trending-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}


/* ── 7. LIVE SUGGESTIONS PANEL ───────────────────────────────── */
.srch-suggestions {
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  flex: 1;
  scrollbar-width: thin;
}

.srch-group {
  padding: var(--sp-4) var(--sp-5) var(--sp-2);
  border-bottom: 1px solid var(--clr-border);
}

.srch-group:last-of-type {
  border-bottom: none;
}

.srch-group__label {
  font-size: 11px;
  font-weight: 900;
  color: var(--clr-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.srch-group__label i {
  font-size: 13px;
  color: var(--clr-red);
}

.srch-group__items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.srch-group__items--pills {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--sp-2);
}


/* ── 8. PRODUCT ROW (suggestion item) ────────────────────────── */
.srch-product-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background var(--t-fast);
}

.srch-product-row:hover,
.srch-product-row:focus-visible {
  background: var(--clr-rose);
  outline: none;
}

.srch-product-row__img {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--clr-rose), var(--clr-nude));
  font-size: 20px;
  color: var(--clr-nude);
  overflow: hidden;
}

/* Reuse product image bg classes from style.css */
.srch-product-row__img.product-card__img--gray   { background: linear-gradient(135deg,#F0F0F0,#D8D8D8); }
.srch-product-row__img.product-card__img--honey  { background: linear-gradient(135deg,#FFF8E8,#F0D890); }
.srch-product-row__img.product-card__img--violet { background: linear-gradient(135deg,#F5E8FF,#D5A8E8); }
.srch-product-row__img.product-card__img--blue   { background: linear-gradient(135deg,#E8F0FF,#A8C0F0); }
.srch-product-row__img.pd-gallery__placeholder--brown   { background: linear-gradient(135deg,#FFF5F5,#E8D5C4); }
.srch-product-row__img.pd-gallery__placeholder--natural { background: linear-gradient(135deg,#FFF8F0,#F0D0B0); }

.srch-product-row__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.srch-product-row__brand {
  font-size: 11px;
  font-weight: 700;
  color: var(--clr-red);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.srch-product-row__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--clr-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.srch-product-row__price {
  font-size: 13px;
  font-weight: 900;
  color: var(--clr-red);
}

.srch-product-row__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-1);
  flex-shrink: 0;
}

.srch-product-row__arrow {
  font-size: 16px;
  color: var(--clr-light);
}


/* ── 9. HIGHLIGHT MARK ────────────────────────────────────────── */
mark.srch-highlight {
  background: transparent;
  color: var(--clr-red);
  font-weight: 900;
}


/* ── 10. SUGGESTIONS FOOTER ───────────────────────────────────── */
.srch-suggestions__footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--clr-border);
  background: var(--clr-rose);
}

.srch-suggestions__all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  font-size: 14px;
  font-weight: 700;
  color: var(--clr-red);
  text-decoration: none;
  padding: var(--sp-2) 0;
  transition: opacity var(--t-fast);
}

.srch-suggestions__all:hover {
  opacity: 0.75;
}

.srch-suggestions__all i {
  font-size: 16px;
}


/* ── 11. NO RESULTS MINI (in suggestions) ────────────────────── */
.srch-no-results-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-6);
  font-size: 14px;
  color: var(--clr-muted);
  font-weight: 600;
  text-align: center;
}

.srch-no-results-mini i {
  font-size: 36px;
  color: var(--clr-border-md);
}


/* ── 12. SEARCH RESULTS PAGE HERO ────────────────────────────── */
.srch-page-hero {
  position: relative;
  background: linear-gradient(160deg, var(--clr-rose) 0%, var(--clr-bg) 55%);
  padding-block: var(--sp-8) var(--sp-6);
  overflow: hidden;
}

.srch-page-hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}


/* ── 13. INLINE PAGE SEARCH BAR ───────────────────────────────── */
.srch-page-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--clr-surface);
  border: 1.5px solid var(--clr-border-md);
  border-radius: var(--r-xl);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-sm);
  max-width: 620px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.srch-page-bar:focus-within {
  border-color: var(--clr-red);
  box-shadow: 0 0 0 4px rgba(213,0,0,0.07);
}

.srch-page-bar__icon {
  font-size: 20px;
  color: var(--clr-red);
  flex-shrink: 0;
}

.srch-page-bar__input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 600;
  color: var(--clr-text);
  background: transparent;
  caret-color: var(--clr-red);
  min-width: 0;
}

.srch-page-bar__input::placeholder {
  color: var(--clr-light);
  font-weight: 400;
}


/* ── 14. RESULT HEADLINE META ─────────────────────────────────── */
.srch-page-hero__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.srch-page-hero__query {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 900;
  color: var(--clr-text);
  line-height: 1.2;
}

.srch-page-hero__query em {
  color: var(--clr-red);
  font-style: normal;
}

.srch-page-hero__count {
  font-size: 14px;
  color: var(--clr-muted);
  font-weight: 700;
  background: var(--clr-rose);
  border: 1px solid var(--clr-nude);
  border-radius: var(--r-pill);
  padding: 4px 14px;
}


/* ── 15. EMPTY STATE: SEARCH SPECIFIC ────────────────────────── */
.srch-empty__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
  margin-top: var(--sp-2);
}

.srch-empty {
  padding-block: var(--sp-12);
}


/* ── 16. SORT: RELEVANCE OPTION (search page only) ───────────── */
/* Already covered by shop-sort__select from shop.css */


/* ── 17. SEARCH INTEGRATION: existing .search-bar suppression ── */
/*
   When the overlay is active, the legacy .search-bar strip (from
   style.css) is hidden so they don't both appear.
   The existing #searchToggle now opens the overlay instead.
*/
.srch-overlay.open ~ .navbar .search-bar,
.search-bar {
  /* Kept in DOM for non-JS fallback, overlay takes precedence */
}


/* ── 18. SCROLL ANIMATIONS (search page fade-ins) ────────────── */
/* Inherited from style.css .fade-in-up — no new rules needed */


/* ── 19. PRINT ───────────────────────────────────────────────── */
@media print {
  .srch-overlay,
  .srch-page-bar { display: none !important; }
}
