/*
 * search.css
 * Dark full-screen search overlay with trending content + predictive results.
 */

/* ─── SEARCH MODAL ──────────────────────────────────────────────*/
.search-modal {
  position: fixed;
  inset: 0;
  z-index: var(--theme-z-modal);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--theme-duration-base) var(--theme-ease-out),
    visibility var(--theme-duration-base);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.search-modal--open {
  opacity: 1;
  visibility: visible;
}

.search-modal__backdrop {
  position: fixed;
  inset: 0;
  background-color: var(--theme-color-header-bg);
}

.search-modal__container {
  position: relative;
  background-color: var(--theme-color-header-bg);
  min-height: 100vh;
  padding: var(--theme-space-md) 0 var(--theme-space-2xl);
}

.search-modal__inner {
  max-width: var(--theme-max-width-content);
  margin: 0 auto;
  padding: 0 var(--theme-gutter-desktop);
}

/* ─── CLOSE BUTTON (top-right) ─────────────────────────────────*/
.search-modal__close {
  position: absolute;
  top: var(--theme-space-md);
  right: var(--theme-gutter-desktop);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: var(--theme-border-width) solid var(--theme-color-border-inverse);
  border-radius: var(--theme-radius-full);
  cursor: pointer;
  color: var(--theme-color-text-inverse);
  transition:
    background-color var(--theme-duration-fast) var(--theme-ease-out),
    border-color var(--theme-duration-fast) var(--theme-ease-out);
}

.search-modal__close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ─── SEARCH INPUT ──────────────────────────────────────────────*/
.search-modal__form {
  margin: 0 0 var(--theme-space-lg);
  max-width: 600px;
}

.search-modal__input-wrap {
  display: flex;
  align-items: center;
  gap: var(--theme-space-xs);
  border: var(--theme-border-width) solid var(--theme-color-border-inverse);
  border-radius: var(--theme-radius-full);
  padding: var(--theme-space-2xs) var(--theme-space-md);
  background-color: rgba(255, 255, 255, 0.06);
  transition: border-color var(--theme-duration-fast) var(--theme-ease-out);
}

.search-modal__input-wrap:focus-within {
  border-color: var(--theme-color-brand-gold);
}

.search-modal__input-wrap svg {
  flex-shrink: 0;
  color: var(--theme-color-header-text-muted);
}

.search-modal__input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--theme-font-body);
  font-size: var(--theme-text-md);
  color: var(--theme-color-text-inverse);
  height: var(--theme-btn-height-md);
}

.search-modal__input::placeholder {
  color: var(--theme-color-header-text-muted);
}

.search-modal__input::-webkit-search-cancel-button,
.search-modal__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-modal__clear {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: var(--theme-space-3xs);
  cursor: pointer;
  color: var(--theme-color-header-text-muted);
  transition: color var(--theme-duration-fast) var(--theme-ease-out);
}

.search-modal__clear:hover {
  color: var(--theme-color-text-inverse);
}

/* ─── POPULAR SEARCHES (pill bar) ──────────────────────────────*/
.search-popular {
  margin-bottom: var(--theme-space-lg);
}

.search-popular__heading {
  font-family: var(--theme-font-heading);
  font-size: var(--theme-text-xs);
  font-weight: var(--theme-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--theme-tracking-widest);
  color: var(--theme-color-brand-gold);
  margin: 0 0 var(--theme-space-sm);
}

.search-popular__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--theme-space-2xs);
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-popular__pill {
  display: inline-block;
  font-family: var(--theme-font-ui);
  font-size: var(--theme-text-sm);
  font-weight: var(--theme-weight-medium);
  color: var(--theme-color-text-inverse);
  text-decoration: none;
  padding: var(--theme-space-2xs) var(--theme-space-sm);
  border: var(--theme-border-width) solid var(--theme-color-border-inverse);
  border-radius: var(--theme-radius-full);
  transition:
    background-color var(--theme-duration-fast) var(--theme-ease-out),
    border-color var(--theme-duration-fast) var(--theme-ease-out),
    color var(--theme-duration-fast) var(--theme-ease-out);
  white-space: nowrap;
  cursor: pointer;
}

.search-popular__pill:hover {
  background-color: var(--theme-color-brand-gold);
  border-color: var(--theme-color-brand-gold);
  color: var(--theme-color-white);
}

/* ─── RESULTS AREA ─────────────────────────────────────────────*/
.search-modal__results {
  margin-top: 0;
}

/* ─── SECTION HEADINGS ─────────────────────────────────────────*/
.search-results__heading {
  font-family: var(--theme-font-heading);
  font-size: var(--theme-text-xs);
  font-weight: var(--theme-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--theme-tracking-widest);
  color: var(--theme-color-brand-gold);
  margin: 0 0 var(--theme-space-sm);
}

/* ─── TWO-COLUMN LAYOUT ───────────────────────────────────────*/
.search-results__layout {
  display: flex;
  gap: var(--theme-space-2xl);
}

.search-results__left {
  flex-shrink: 0;
  width: 240px;
}

.search-results__right {
  flex: 1;
  min-width: 0;
}

.search-results__right-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--theme-space-sm);
}

.search-results__right-header .search-results__heading {
  margin: 0;
}

/* ─── LEFT SIDEBAR SECTIONS ───────────────────────────────────*/
.search-results__sidebar-section {
  margin-bottom: var(--theme-space-lg);
}

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

/* ─── CATEGORY / RANGE LINK LISTS ─────────────────────────────*/
.search-results__link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.search-results__link-item {
  font-family: var(--theme-font-body);
  font-size: var(--theme-text-md);
  font-weight: var(--theme-weight-normal);
  color: var(--theme-color-text-inverse);
  text-decoration: none;
  padding: var(--theme-space-3xs) 0;
  display: block;
  transition: color var(--theme-duration-fast) var(--theme-ease-out);
}

.search-results__link-item:hover {
  color: var(--theme-color-brand-gold);
}

/* ── Collection links (search results variant) ── */
.search-results__collections {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.search-results__collection-link {
  display: block;
  font-family: var(--theme-font-body);
  font-size: var(--theme-text-md);
  font-weight: var(--theme-weight-normal);
  color: var(--theme-color-text-inverse);
  text-decoration: none;
  padding: var(--theme-space-3xs) 0;
  transition: color var(--theme-duration-fast) var(--theme-ease-out);
}

.search-results__collection-link:hover {
  color: var(--theme-color-brand-gold);
}

/* ─── PRODUCT GRID ─────────────────────────────────────────────*/
.search-results__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--theme-space-md);
}

.search-results__product-card {
  display: flex;
  flex-direction: column;
  gap: var(--theme-space-2xs);
  text-decoration: none;
  transition: opacity var(--theme-duration-fast) var(--theme-ease-out);
}

.search-results__product-card:hover {
  opacity: 0.85;
}

.search-results__product-image {
  aspect-ratio: 4 / 5;
  border-radius: var(--theme-radius-md);
  overflow: hidden;
  background-color: var(--theme-color-gray-700);
}

.search-results__product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-results__product-image--empty {
  background-color: var(--theme-color-gray-700);
}

.search-results__product-name {
  font-family: var(--theme-font-heading);
  font-size: var(--theme-text-sm);
  font-weight: var(--theme-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--theme-tracking-wide);
  color: var(--theme-color-text-inverse);
  line-height: var(--theme-leading-snug);
}

.search-results__product-type {
  font-family: var(--theme-font-body);
  font-size: var(--theme-text-sm);
  font-weight: var(--theme-weight-normal);
  color: rgba(255, 255, 255, 0.7);
}

.search-results__product-price {
  font-family: var(--theme-font-ui);
  font-size: var(--theme-text-md);
  font-weight: var(--theme-weight-bold);
  color: var(--theme-color-text-inverse);
}

/* ── View all link ── */
.search-results__view-all {
  font-family: var(--theme-font-heading);
  font-size: var(--theme-text-xs);
  font-weight: var(--theme-weight-bold);
  color: var(--theme-color-brand-gold);
  text-decoration: underline;
  text-underline-offset: var(--theme-space-3xs);
  text-transform: uppercase;
  letter-spacing: var(--theme-tracking-wide);
}

.search-results__view-all:hover {
  color: var(--theme-color-brand-gold-light);
}

/* ── Empty state ── */
.search-results__empty {
  text-align: center;
  padding: var(--theme-space-xl) 0;
  font-family: var(--theme-font-body);
  font-size: var(--theme-text-md);
  color: var(--theme-color-header-text-muted);
}

/* ─── SEARCH RESULTS PAGE ───────────────────────────────────────*/
.search-page {
  padding: var(--theme-space-md) 0 var(--theme-space-2xl);
}

.search-page__header {
  text-align: center;
  padding: var(--theme-space-lg) 0;
}

.search-page__title {
  font-family: var(--theme-font-heading);
  font-size: var(--theme-text-2xl);
  font-weight: var(--theme-weight-bold);
  color: var(--theme-color-text-primary);
  margin: 0 0 var(--theme-space-sm);
}

.search-page__form {
  max-width: var(--theme-max-width-narrow);
  margin: 0 auto var(--theme-space-lg);
}

/* ─── LOADING SPINNER ──────────────────────────────────────────*/
.search-loading {
  display: flex;
  justify-content: center;
  padding: var(--theme-space-2xl) 0;
}

.search-loading__spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--theme-color-brand-gold);
  border-radius: var(--theme-radius-full);
  animation: search-spin 0.6s linear infinite;
}

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

/* Reset input-wrap to light theme on the search results page */
.search-page__form .search-modal__input-wrap {
  background-color: var(--theme-color-white);
  border-color: var(--theme-color-border-strong);
}

.search-page__form .search-modal__input-wrap:focus-within {
  border-color: var(--theme-color-brand-gold);
  box-shadow: var(--theme-input-shadow-focus);
}

.search-page__form .search-modal__input-wrap svg {
  color: var(--theme-color-text-muted);
}

.search-page__form .search-modal__input {
  color: var(--theme-color-text-primary);
}

.search-page__form .search-modal__input::placeholder {
  color: var(--theme-color-text-muted);
}

.search-page__count {
  font-family: var(--theme-font-ui);
  font-size: var(--theme-text-sm);
  color: var(--theme-color-text-muted);
  margin-bottom: var(--theme-space-md);
}

.search-page__grid {
  display: grid;
  grid-template-columns: var(--theme-grid-cols-collection);
  gap: var(--theme-grid-gap);
}

.search-page__empty {
  text-align: center;
  padding: var(--theme-space-2xl) 0;
}

.search-page__empty-title {
  font-family: var(--theme-font-heading);
  font-size: var(--theme-text-xl);
  font-weight: var(--theme-weight-bold);
  color: var(--theme-color-text-primary);
  margin: var(--theme-space-md) 0 var(--theme-space-xs);
}

.search-page__empty-text {
  font-family: var(--theme-font-body);
  font-size: var(--theme-text-md);
  color: var(--theme-color-text-muted);
  margin: 0 0 var(--theme-space-lg);
}

/* ─── RESPONSIVE ───────────────────────────────────────────────*/
@media (max-width: 1023px) {
  .search-results__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .search-modal__inner {
    padding: 0 var(--theme-gutter);
  }

  .search-modal__close {
    right: var(--theme-gutter);
  }

  .search-modal__container {
    padding: var(--theme-space-md) 0 var(--theme-space-xl);
  }

  .search-modal__form {
    padding-right: var(--theme-space-xl);
  }

  .search-popular__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--theme-space-2xs);
  }

  .search-results__layout {
    flex-direction: column;
    gap: var(--theme-space-lg);
  }

  .search-results__left {
    width: 100%;
  }

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

  .search-page__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--theme-grid-gap-sm);
  }
}
