/* ═══════════════════════════════════════════════════════
   SPRINT DRIVES — Smart Search
   Floating search bar in nav · Live AJAX results
   Full search results page styling
═════════════════════════════════════════════════════════ */

/* ── NAV SEARCH TRIGGER BUTTON ── */
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Exactly match .nav-cart: 40×40px desktop */
  width: 40px; height: 40px; min-width: 40px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: all 0.2s var(--e);
}
.nav-search-btn:hover {
  background: rgba(211,214,58,0.15);
  border-color: var(--L);
  color: var(--L);
}
.nav-search-btn svg {
  /* Exactly match .nav-cart svg: 18×18px */
  width: 18px; height: 18px;
  stroke: currentColor; stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  display: block;
}

/* Mobile: match .nav-cart shrink to 38px */
@media (max-width: 1100px) {
  .nav-search-btn {
    width: 38px; height: 38px; min-width: 38px;
  }
  .nav-search-btn svg {
    width: 16px; height: 16px;
  }
}

/* ── SEARCH MODAL OVERLAY ── */
.sd-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(7,8,28,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0s linear 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 100px;
}
.sd-search-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s, visibility 0s linear 0s;
}

/* ── SEARCH INPUT FIELD ── */
.sd-search-box {
  width: min(740px, calc(100vw - 48px));
  position: relative;
}

.sd-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.sd-search-icon {
  position: absolute;
  left: 18px;
  width: 20px; height: 20px;
  stroke: var(--MUT); stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
  flex-shrink: 0;
}

#sd-search-input {
  width: 100%;
  border: none;
  outline: none;
  font-family: var(--fb);
  font-size: 18px;
  font-weight: 400;
  color: var(--INK);
  padding: 20px 60px 20px 52px;
  background: transparent;
  box-shadow: none;
}
#sd-search-input::placeholder {
  color: var(--MUT);
}

.sd-search-clear {
  position: absolute;
  right: 16px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--BD);
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--MUT);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.sd-search-clear:hover { background: var(--N); color: #fff; }
.sd-search-clear.visible { display: flex; }
.sd-search-clear svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.5; fill: none; }

/* ── SEARCH SUGGESTIONS / QUICK LINKS ── */
.sd-search-suggestions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sd-search-sug-label {
  font-family: var(--fb);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  flex-shrink: 0;
}
.sd-search-sug {
  font-family: var(--fb);
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 100px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.sd-search-sug:hover {
  background: rgba(211,214,58,0.12);
  border-color: var(--L);
  color: var(--L);
}

/* ── LIVE RESULTS DROPDOWN ── */
.sd-search-results {
  width: min(740px, calc(100vw - 48px));
  margin-top: 8px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  overflow: hidden;
  max-height: 480px;
  overflow-y: auto;
  display: none;
}
.sd-search-results.has-results { display: block; }
.sd-search-results::-webkit-scrollbar { width: 4px; }
.sd-search-results::-webkit-scrollbar-track { background: #f5f5f5; }
.sd-search-results::-webkit-scrollbar-thumb { background: var(--BD); border-radius: 2px; }

/* Results header */
.sd-results-header {
  padding: 12px 18px;
  background: #f8f8f6;
  border-bottom: 1px solid var(--BD);
  font-family: var(--fb);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--MUT);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sd-results-count { color: var(--N); }

/* Individual result item */
.sd-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  text-decoration: none;
  color: var(--INK);
  border-bottom: 1px solid #f0f0ec;
  transition: background 0.15s;
}
.sd-result-item:hover { background: #f8f8f6; }
.sd-result-item:last-child { border-bottom: none; }

.sd-result-img {
  width: 52px; height: 52px;
  border-radius: 4px;
  overflow: hidden;
  background: #f0f0ec;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sd-result-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 4px;
}
.sd-result-img-placeholder svg {
  width: 22px; height: 22px;
  stroke: var(--MUT); stroke-width: 1.5; fill: none;
}

.sd-result-info { flex: 1; min-width: 0; }
.sd-result-cat {
  font-family: var(--fb);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--N);
  margin-bottom: 3px;
}
.sd-result-name {
  font-family: var(--fb);
  font-size: 13px;
  font-weight: 600;
  color: var(--INK);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Highlight matching text */
.sd-result-name mark {
  background: rgba(211,214,58,0.3);
  color: var(--INK);
  border-radius: 2px;
  padding: 0 1px;
}
.sd-result-price {
  font-family: var(--fb);
  font-size: 12px;
  font-weight: 700;
  color: var(--N);
  flex-shrink: 0;
}

/* Category result items */
.sd-result-item.is-cat .sd-result-img {
  background: var(--N5);
}
.sd-result-item.is-cat .sd-result-img svg {
  stroke: var(--L);
}

/* "View all" link at bottom */
.sd-results-footer {
  padding: 12px 18px;
  background: #f8f8f6;
  border-top: 1px solid var(--BD);
  text-align: center;
}
.sd-results-footer a {
  font-family: var(--fb);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--N);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.sd-results-footer a:hover { color: var(--L2); }
.sd-results-footer svg {
  width: 11px; height: 11px;
  stroke: currentColor; stroke-width: 2.5; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Loading state */
.sd-search-loading {
  padding: 24px;
  text-align: center;
  font-family: var(--fb);
  font-size: 13px;
  color: var(--MUT);
  display: none;
}
.sd-search-loading.active { display: block; }

/* No results */
.sd-no-results {
  padding: 28px 18px;
  text-align: center;
  font-family: var(--fb);
  font-size: 14px;
  color: var(--MUT);
  display: none;
}
.sd-no-results.active { display: block; }
.sd-no-results strong { color: var(--INK); }

/* Close hint */
.sd-search-close-hint {
  margin-top: 20px;
  font-family: var(--fb);
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
kbd {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: var(--fb);
}

/* ── SEARCH RESULTS PAGE ── */
.sd-search-page {
  padding: 48px 0 80px;
  min-height: 60vh;
}
.sd-search-page-header {
  margin-bottom: 36px;
}
.sd-search-page-title {
  font-family: var(--fh);
  font-size: clamp(1.8rem, 4vw, 3rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--INK);
  margin-bottom: 8px;
}
.sd-search-page-meta {
  font-family: var(--fb);
  font-size: 14px;
  color: var(--MUT);
}
.sd-search-page-meta strong { color: var(--N); }

/* Search results grid */
.sd-search-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
@media (max-width: 1024px) { .sd-search-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .sd-search-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }

/* Reuse WooCommerce product card styles */
.sd-search-grid .woocommerce-LoopProduct-link { display: block; }

/* Search form (in results page) */
.sd-search-form-wrap {
  margin-bottom: 32px;
  position: relative;
  max-width: 540px;
}
.sd-search-form-wrap input[type="search"] {
  width: 100%;
  font-size: 16px;
  padding: 14px 52px 14px 18px;
  border: 2px solid var(--BD);
  border-radius: 6px;
  background: #fff;
  color: var(--INK);
  transition: border-color 0.15s;
}
.sd-search-form-wrap input[type="search"]:focus {
  border-color: var(--N);
  box-shadow: 0 0 0 3px rgba(51,52,127,0.1);
}
.sd-search-form-wrap button {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--MUT);
  padding: 0;
}
.sd-search-form-wrap button svg {
  width: 18px; height: 18px;
  stroke: currentColor; stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
