/* Smart WooCommerce Search — Frontend Styles */

:root {
  --sws-primary:       #111;
  --sws-border:        #ccc;
  --sws-border-focus:  #111;
  --sws-bg:            #fff;
  --sws-dropdown-bg:   #fff;
  --sws-highlight:     #e00000;
  --sws-text:          #222;
  --sws-muted:         #777;
  --sws-hover-bg:      #f4f4f4;
  --sws-radius:        999px;
  --sws-shadow:        0 8px 30px rgba(0,0,0,.13);
  --sws-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Wrapper */
.sws-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  font-family: var(--sws-font);
  z-index: 9999;
}

/* Search bar */
.sws-search-bar {
  display: flex;
  align-items: center;
  background: var(--sws-bg);
  border: 2px solid var(--sws-border);
  border-radius: var(--sws-radius);
  padding: 0 8px 0 16px;
  transition: border-color .2s, box-shadow .2s;
  height: 48px;
}

.sws-search-bar:focus-within {
  border-color: var(--sws-border-focus);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

.sws-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
  font-size: 15px;
  color: var(--sws-text);
  font-family: var(--sws-font);
  padding: 0;
  margin: 0;
}

.sws-input::placeholder { color: var(--sws-muted); }

.sws-clear-btn,
.sws-submit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--sws-muted);
  display: flex;
  align-items: center;
  transition: color .15s;
}
.sws-clear-btn:hover,
.sws-submit-btn:hover { color: var(--sws-primary); }

.sws-submit-btn {
  background: var(--sws-primary);
  color: #fff;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  justify-content: center;
  margin-left: 4px;
  flex-shrink: 0;
}
.sws-submit-btn:hover { opacity: .85; }

/* Dropdown */
.sws-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--sws-dropdown-bg);
  border: 1px solid var(--sws-border);
  border-radius: 12px;
  box-shadow: var(--sws-shadow);
  overflow: hidden;
  z-index: 99999;
  max-height: 520px;
  overflow-y: auto;
}

/* Section headers */
.sws-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sws-muted);
  padding: 10px 14px 4px;
  border-top: 1px solid #eee;
}
.sws-section-title:first-child { border-top: none; }

/* Items */
.sws-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--sws-text);
  transition: background .12s;
}
.sws-item:hover,
.sws-item.is-active {
  background: var(--sws-hover-bg);
}

/* Product image */
.sws-item-img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid #eee;
}
.sws-item-img-placeholder {
  width: 42px;
  height: 42px;
  background: #f0f0f0;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #bbb;
}

/* Product info */
.sws-item-info { flex: 1; min-width: 0; }
.sws-item-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sws-item-meta {
  font-size: 12px;
  color: var(--sws-muted);
  margin-top: 2px;
}
.sws-item-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--sws-primary);
  white-space: nowrap;
  margin-left: auto;
  padding-left: 8px;
}

/* Highlight matched text */
.sws-highlight { color: var(--sws-highlight); font-weight: 700; }

/* Category / tag items */
.sws-cat-icon {
  font-size: 18px;
  width: 42px;
  text-align: center;
}

/* See all results row */
.sws-see-all {
  display: block;
  text-align: center;
  padding: 11px;
  font-size: 13px;
  font-weight: 600;
  color: #0073aa;
  border-top: 1px solid #eee;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s;
}
.sws-see-all:hover { background: var(--sws-hover-bg); }

/* Spinner */
.sws-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  color: var(--sws-muted);
  font-size: 13px;
}
.sws-spinner::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid #ddd;
  border-top-color: #555;
  border-radius: 50%;
  animation: sws-spin .6s linear infinite;
  margin-right: 8px;
}
@keyframes sws-spin { to { transform: rotate(360deg); } }

/* No results */
.sws-no-results {
  padding: 18px;
  text-align: center;
  color: var(--sws-muted);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 640px) {
  .sws-dropdown { border-radius: 8px; }
  .sws-item-img, .sws-item-img-placeholder { width: 36px; height: 36px; }
}
