/*
 * Advanced WooCommerce Search — style.css
 * Clean, modern e-commerce search bar.
 */

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --aws-accent:        #1a3c5e;   /* navy, matches solutionspro brand */
  --aws-accent-hover:  #122d47;
  --aws-bg:            #ffffff;
  --aws-border:        #d0d7e2;
  --aws-border-focus:  #1a3c5e;
  --aws-text:          #1a2433;
  --aws-muted:         #6b7a90;
  --aws-result-hover:  #f4f7fb;
  --aws-shadow:        0 8px 32px rgba(26,60,94,.13);
  --aws-radius:        10px;
  --aws-radius-sm:     6px;
  --aws-height:        46px;
  --aws-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --aws-transition:    150ms ease;
  --aws-z:             99999;
}

/* ── Wrapper ────────────────────────────────────────────────────────────── */
.aws-wrapper {
  position: relative;
  font-family: var(--aws-font);
  width: 100%;
  max-width: 680px;
}

/* ── Search Bar ─────────────────────────────────────────────────────────── */
.aws-search-bar {
  display: flex;
  align-items: center;
  height: var(--aws-height);
  background: var(--aws-bg);
  border: 1.5px solid var(--aws-border);
  border-radius: var(--aws-radius);
  overflow: hidden;
  transition: border-color var(--aws-transition), box-shadow var(--aws-transition);
}

.aws-search-bar:focus-within {
  border-color: var(--aws-border-focus);
  box-shadow: 0 0 0 3px rgba(26,60,94,.12);
}

/* ── Category Dropdown ──────────────────────────────────────────────────── */
.aws-category-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.aws-category-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--aws-font);
  font-size: 13px;
  font-weight: 500;
  color: var(--aws-text);
  cursor: pointer;
  padding: 0 30px 0 14px;
  height: var(--aws-height);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aws-category-select:focus {
  outline: none;
}

.aws-category-chevron {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--aws-muted);
  pointer-events: none;
  line-height: 1;
  display: flex;
  align-items: center;
}

/* ── Divider ────────────────────────────────────────────────────────────── */
.aws-divider {
  width: 1px;
  height: 22px;
  background: var(--aws-border);
  flex-shrink: 0;
}

/* ── Text Input Wrap ────────────────────────────────────────────────────── */
.aws-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  min-width: 0;
}

.aws-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--aws-font);
  font-size: 14px;
  color: var(--aws-text);
  padding: 0 10px 0 14px;
  height: var(--aws-height);
  min-width: 0;
  width: 100%;
}

.aws-input::placeholder {
  color: var(--aws-muted);
  font-weight: 400;
}

/* ── Clear Button ───────────────────────────────────────────────────────── */
.aws-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--aws-muted);
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--aws-transition);
  flex-shrink: 0;
  height: var(--aws-height);
}

.aws-clear-btn:hover {
  color: var(--aws-text);
}

/* ── Search Button ──────────────────────────────────────────────────────── */
.aws-search-btn {
  background: var(--aws-accent);
  border: none;
  cursor: pointer;
  color: #fff;
  width: 52px;
  height: var(--aws-height);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--aws-transition);
  padding: 0;
  border-radius: 0 calc(var(--aws-radius) - 1px) calc(var(--aws-radius) - 1px) 0;
  position: relative;
}

.aws-search-btn:hover {
  background: var(--aws-accent-hover);
}

.aws-search-btn:focus-visible {
  outline: 2px solid var(--aws-accent);
  outline-offset: 2px;
}

.aws-search-icon {
  display: block;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.aws-spinner {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: aws-spin 0.65s linear infinite;
  position: absolute;
}

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

/* ── Results Dropdown ───────────────────────────────────────────────────── */
.aws-results {
  position: absolute;
  top: calc(var(--aws-height) + 6px);
  left: 0;
  right: 0;
  background: var(--aws-bg);
  border: 1.5px solid var(--aws-border);
  border-radius: var(--aws-radius);
  box-shadow: var(--aws-shadow);
  z-index: var(--aws-z);
  overflow: hidden;
  animation: aws-dropdown-in 0.15s ease;
}

@keyframes aws-dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Result Items ───────────────────────────────────────────────────────── */
.aws-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--aws-text);
  border-bottom: 1px solid #f0f3f7;
  transition: background var(--aws-transition);
  cursor: pointer;
  outline: none;
}

.aws-result-item:last-of-type {
  border-bottom: none;
}

.aws-result-item:hover,
.aws-result-item:focus,
.aws-result-item[aria-selected="true"] {
  background: var(--aws-result-hover);
}

.aws-result-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--aws-radius-sm);
  border: 1px solid #edf0f5;
  background: #f8f9fb;
  flex-shrink: 0;
}

.aws-result-info {
  flex: 1;
  min-width: 0;
}

.aws-result-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--aws-text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Highlighted match */
.aws-result-title mark {
  background: #fff3b0;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  font-weight: 600;
}

.aws-result-sku {
  font-size: 11px;
  color: var(--aws-muted);
  margin-top: 1px;
}

.aws-result-price {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--aws-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.aws-result-price del {
  color: var(--aws-muted);
  font-weight: 400;
  font-size: 12px;
  margin-right: 4px;
}

/* ── No Results ─────────────────────────────────────────────────────────── */
.aws-no-results {
  padding: 20px 16px;
  text-align: center;
  color: var(--aws-muted);
  font-size: 14px;
}

.aws-no-results svg {
  display: block;
  margin: 0 auto 8px;
  opacity: 0.4;
}

/* ── View All ───────────────────────────────────────────────────────────── */
.aws-view-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--aws-accent);
  text-decoration: none;
  border-top: 1.5px solid #edf0f5;
  background: #f9fafc;
  transition: background var(--aws-transition), color var(--aws-transition);
}

.aws-view-all:hover {
  background: #f0f4f9;
  color: var(--aws-accent-hover);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .aws-category-select {
    max-width: 110px;
    font-size: 12px;
  }

  .aws-input {
    font-size: 13px;
  }

  .aws-search-btn {
    width: 46px;
  }
}

@media (max-width: 420px) {
  .aws-category-wrap {
    display: none;  /* hide category on very small screens */
  }

  .aws-divider {
    display: none;
  }
}
