/* ============================================================
   TargetWeb — search.css
   Header search panel, predictive dropdown, search results pages
   ============================================================ */

/* ── Search panel (drops over the page) ───────────────────── */
.tw-search-bar {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--header-bg, #ffffff);
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition:
    opacity 0.2s ease,
    transform 0.24s ease,
    visibility 0s linear 0.24s;
}
.tw-search-bar.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity 0.2s ease,
    transform 0.24s ease,
    visibility 0s;
}
.tw-search-bar > .tw-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-top: 22px;
  padding-bottom: 22px;
}
.tw-search-panel {
  position: relative;
  flex: 1;
  max-width: 820px;
  margin: 0 auto;
}

.tw-search-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(17, 17, 17, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.tw-search-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease, visibility 0s;
}

/* ── Form ─────────────────────────────────────────────────── */
.tw-search-form {
  position: relative;
  display: flex;
  align-items: center;
  height: 58px;
  background: #fff;
  border: 2px solid var(--color-dark, #1a1a1a);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.tw-search-form:focus-within {
  border-color: var(--color-primary, #e63030);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary, #e63030) 14%, transparent);
}
.tw-search-form__icon {
  flex-shrink: 0;
  margin: 0 4px 0 18px;
  color: #8a8a8a;
}
.tw-search-form:focus-within .tw-search-form__icon {
  color: var(--color-primary, #e63030);
}
.tw-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 12px;
  border: none !important;
  outline: none;
  background: transparent;
  box-shadow: none !important;
  font-family: var(--font-body, inherit);
  font-size: 17px;
  color: var(--color-dark, #1a1a1a);
}
.tw-search-input::placeholder {
  color: #9a9a9a;
}
.tw-search-input::-webkit-search-cancel-button,
.tw-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.tw-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  margin-right: 6px;
  padding: 0;
  border: none;
  background: #f1f1f1;
  color: #555;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tw-search-clear:hover {
  background: var(--color-dark, #1a1a1a);
  color: #fff;
}
.tw-search-clear[hidden] {
  display: none;
}

.tw-search-spinner {
  display: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--color-primary, #e63030);
  border-radius: 50%;
  animation: tw-search-spin 0.7s linear infinite;
}
.tw-search-form.is-loading .tw-search-spinner {
  display: block;
}
@keyframes tw-search-spin {
  to { transform: rotate(360deg); }
}

.tw-search-submit {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  height: 100%;
  padding: 0 26px;
  border: none;
  background: var(--color-dark, #1a1a1a);
  color: #fff;
  font-family: var(--font-heading, inherit);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s;
}
.tw-search-submit:hover {
  background: #000;
}
.tw-search-submit__icon {
  transition: transform 0.18s;
}
.tw-search-submit:hover .tw-search-submit__icon {
  transform: translateX(3px);
}

.tw-search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 46px;
  height: 58px;
  padding: 0;
  border: none;
  background: transparent;
  color: #555;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.tw-search-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-primary, #e63030);
}

/* ── Quick links under the field ──────────────────────────── */
.tw-search-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.tw-search-quick[hidden] {
  display: none;
}
.tw-search-quick__label,
.tw-search-chips__label {
  margin-right: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a8a8a;
}
.tw-search-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid #dcdcdc;
  background: #fff;
  color: var(--color-dark, #1a1a1a);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tw-search-chip:hover,
.tw-search-chip:focus-visible {
  border-color: var(--color-primary, #e63030);
  color: var(--color-primary, #e63030);
}

/* ── Predictive dropdown ──────────────────────────────────── */
.tw-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid #e3e3e3;
  border-top: 3px solid var(--color-primary, #e63030);
  box-shadow: 0 20px 44px -10px rgba(0, 0, 0, 0.28);
  animation: tw-ps-in 0.16s ease;
}
.tw-search-results[hidden] {
  display: none;
}
@keyframes tw-ps-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tw-ps-group {
  padding: 14px 0 8px;
}
.tw-ps-group + .tw-ps-group {
  border-top: 1px solid #efefef;
}
.tw-ps-heading {
  margin: 0 0 6px;
  padding: 0 18px;
  font-family: var(--font-heading, inherit);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a8a8a;
}

.tw-search-results mark {
  background: color-mix(in srgb, var(--color-primary, #e63030) 16%, transparent);
  color: inherit;
  padding: 0 1px;
}

/* Category / brand shortcuts */
.tw-ps-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 18px 6px;
}
.tw-ps-term {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid #e0e0e0;
  color: var(--color-dark, #1a1a1a);
  font-size: 13px;
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
}
.tw-ps-term__type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary, #e63030);
}
.tw-ps-term__name {
  font-weight: 600;
}
.tw-ps-term__count {
  min-width: 20px;
  padding: 1px 6px;
  background: #f2f2f2;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: #666;
}
.tw-ps-term.is-active,
.tw-ps-term:hover {
  border-color: var(--color-primary, #e63030);
  background: #fafafa;
}

/* Product rows */
.tw-ps-products {
  display: flex;
  flex-direction: column;
}
.tw-ps-product {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-left: 3px solid transparent;
  color: var(--color-dark, #1a1a1a);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.tw-ps-product.is-active,
.tw-ps-product:hover {
  background: #f7f7f7;
  border-left-color: var(--color-primary, #e63030);
}
.tw-ps-product__thumb {
  display: block;
  width: 56px;
  height: 56px;
  background: #f4f4f4;
  overflow: hidden;
}
.tw-ps-product__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.tw-ps-product__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.tw-ps-product__title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tw-ps-product__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #777;
}
.tw-ps-dot {
  color: #c4c4c4;
}
.tw-ps-product__price {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--color-primary, #e63030);
}
.tw-ps-product__price del {
  margin-right: 4px;
  font-weight: 400;
  color: #999;
}
.tw-ps-product__price ins {
  text-decoration: none;
}
.tw-ps-product__price .tw-cfp-price {
  font-size: 12px;
}

/* Footer link */
.tw-ps-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid #ececec;
  background: #fff;
  color: var(--color-dark, #1a1a1a);
  font-family: var(--font-heading, inherit);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.12s, color 0.12s;
}
.tw-ps-footer.is-active,
.tw-ps-footer:hover {
  background: var(--color-dark, #1a1a1a);
  color: #fff;
}

.tw-ps-empty {
  padding: 26px 18px;
  text-align: center;
}
.tw-ps-empty__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-dark, #1a1a1a);
}
.tw-ps-empty__hint {
  margin: 0;
  font-size: 13px;
  color: #777;
}

/* ── Search results pages ─────────────────────────────────── */
.tw-search-hero {
  padding: 44px 0 40px;
  background: var(--color-dark, #1a1a1a);
  color: #fff;
  text-align: center;
}
.tw-search-hero__eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-primary, #e63030);
}
.tw-search-hero__title {
  margin: 0 0 6px !important;
  font-family: var(--font-heading, inherit);
  font-size: clamp(26px, 4vw, 42px) !important;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #fff !important;
  word-break: break-word;
}
.tw-search-hero__count {
  margin: 0 0 24px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.65);
}
.tw-search-hero__form {
  display: flex;
  align-items: center;
  max-width: 640px;
  height: 54px;
  margin: 0 auto;
  background: #fff;
  border: 2px solid transparent;
  transition: border-color 0.18s;
}
.tw-search-hero__form:focus-within {
  border-color: var(--color-primary, #e63030);
}
.tw-search-hero__icon {
  flex-shrink: 0;
  margin-left: 16px;
  color: #8a8a8a;
}
.tw-search-hero__form input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 12px;
  border: none !important;
  outline: none;
  background: transparent;
  box-shadow: none !important;
  font-size: 16px;
  color: var(--color-dark, #1a1a1a);
}
.tw-search-hero__form button {
  flex-shrink: 0;
  height: 100%;
  padding: 0 24px;
  border: none;
  background: var(--color-primary, #e63030);
  color: #fff;
  font-family: var(--font-heading, inherit);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s;
}
.tw-search-hero__form button:hover {
  background: #000;
}
.tw-searchform {
  margin: 20px 0;
  border-color: var(--color-dark, #1a1a1a);
}
.tw-searchform:focus-within {
  border-color: var(--color-primary, #e63030);
}

.tw-search-page {
  padding: 40px 0 72px;
}
.tw-search-section + .tw-search-section {
  margin-top: 52px;
}
.tw-search-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-dark, #1a1a1a);
}
.tw-search-section__title {
  margin: 0 !important;
  font-family: var(--font-heading, inherit);
  font-size: 20px !important;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tw-search-section__link {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-primary, #e63030);
  text-decoration: none;
}
.tw-search-section__link:hover {
  text-decoration: underline;
}

.tw-search-products ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
}
.tw-search-products ul.products::before,
.tw-search-products ul.products::after {
  display: none !important;
}
.tw-search-products ul.products li.product {
  width: auto !important;
  margin: 0 !important;
  float: none !important;
}

.tw-search-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.tw-search-item {
  display: flex;
  gap: 16px;
  padding: 18px;
  border: 1px solid #e3e3e3;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tw-search-item:hover {
  border-color: var(--color-dark, #1a1a1a);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.35);
}
.tw-search-item__thumb {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  overflow: hidden;
  background: #f4f4f4;
}
.tw-search-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tw-search-item__body {
  min-width: 0;
}
.tw-search-item__type {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary, #e63030);
}
.tw-search-item__title {
  margin: 0 0 6px !important;
  font-size: 18px !important;
  line-height: 1.3;
}
.tw-search-item__title a {
  color: var(--color-dark, #1a1a1a);
  text-decoration: none;
}
.tw-search-item__title a:hover {
  color: var(--color-primary, #e63030);
}
.tw-search-item__excerpt {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #666;
}
.tw-search-item__excerpt p {
  margin: 0;
}

.tw-search-pagination {
  margin-top: 40px;
}
.tw-search-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.tw-search-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #dcdcdc;
  color: var(--color-dark, #1a1a1a);
  font-weight: 600;
  text-decoration: none;
}
.tw-search-pagination .page-numbers.current,
.tw-search-pagination a.page-numbers:hover {
  border-color: var(--color-primary, #e63030);
  background: var(--color-primary, #e63030);
  color: #fff;
}

/* Empty state */
.tw-search-empty {
  max-width: 620px;
  margin: 20px auto;
  padding: 44px 28px;
  border: 1px solid #e3e3e3;
  background: #fff;
  text-align: center;
}
.tw-search-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  background: color-mix(in srgb, var(--color-primary, #e63030) 10%, #fff);
  color: var(--color-primary, #e63030);
}
.tw-search-empty__title {
  margin: 0 0 14px !important;
  font-family: var(--font-heading, inherit);
  font-size: 22px !important;
  font-weight: 700;
  text-transform: uppercase;
  word-break: break-word;
}
.tw-search-empty__tips {
  display: inline-block;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 14px;
  line-height: 1.9;
  color: #666;
}
.tw-search-empty__tips li::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  vertical-align: middle;
  background: var(--color-primary, #e63030);
}
.tw-search-empty .tw-search-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
}
.tw-search-empty .tw-search-chips__label {
  width: 100%;
  margin: 0 0 4px;
}
.tw-search-empty__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* Shop archive in search mode: the dark hero replaces the grey title band */
.tw-shop-page--search .tw-shop-wrap {
  padding-top: 32px !important;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .tw-search-products ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .tw-search-bar > .tw-wrap {
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 6px;
  }
  .tw-search-form {
    height: 52px;
  }
  .tw-search-form__icon {
    margin-left: 12px;
  }
  .tw-search-input {
    font-size: 16px;
    padding: 0 8px;
  }
  .tw-search-submit {
    padding: 0 16px;
  }
  .tw-search-submit__label {
    display: none;
  }
  .tw-search-close {
    width: 40px;
    height: 52px;
  }
  .tw-search-results {
    max-height: calc(100vh - 220px);
  }
  .tw-ps-product {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 14px;
  }
  .tw-ps-product__thumb {
    width: 48px;
    height: 48px;
  }
  .tw-ps-product__price {
    grid-column: 2;
    margin-top: -4px;
    font-size: 13px;
  }
  .tw-ps-heading,
  .tw-ps-terms,
  .tw-ps-footer {
    padding-left: 14px;
    padding-right: 14px;
  }
  .tw-search-hero {
    padding: 32px 0 28px;
  }
  .tw-search-hero__form {
    height: 50px;
  }
  .tw-search-hero__form button {
    padding: 0 16px;
  }
  .tw-search-products ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .tw-search-list {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 420px) {
  .tw-search-item__thumb {
    width: 72px;
    height: 72px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tw-search-bar,
  .tw-search-results,
  .tw-search-backdrop {
    animation: none;
    transition: none;
  }
}