/* ── Smart Search WP ── style.css ── */

:root {
  --sswp-primary: #2563eb;
  --sswp-accent: #f59e0b;
  --sswp-radius: 14px;
  --sswp-shadow: 0 8px 32px rgba(0, 0, 0, .12);
  --sswp-border: #e5e7eb;
  --sswp-bg: #ffffff;
  --sswp-text: #111827;
  --sswp-muted: #6b7280;
  --sswp-hover: #f9fafb;
  --sswp-font: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
}

/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap');

/* ─── Wrapper ─── */
.sswp-wrap {
  position: relative;
  font-family: var(--sswp-font);
  z-index: 1000;
}

.sswp-style-fullwidth {
  width: 100%;
}

.sswp-style-centered {
  max-width: 640px;
  margin: 0 auto;
}

.sswp-style-inline {
  max-width: 520px;
}

/* ─── Input row ─── */
.sswp-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.sswp-input {
  width: 100%;
  padding: 13px 48px 13px 46px;
  font-family: var(--sswp-font);
  font-size: 15px;
  font-weight: 400;
  color: var(--sswp-text);
  background: var(--sswp-bg);
  border: 2px solid var(--sswp-border);
  border-radius: 50px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.sswp-input:focus {
  border-color: var(--sswp-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sswp-primary) 15%, transparent);
}

.sswp-input::placeholder {
  color: #adb5bd;
}

/* Remove native clear button */
.sswp-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.sswp-icon-search {
  position: absolute;
  left: 16px;
  color: var(--sswp-muted);
  display: flex;
  pointer-events: none;
  transition: color .2s;
}

.sswp-input:focus~.sswp-icon-search,
.sswp-input-wrap:focus-within .sswp-icon-search {
  color: var(--sswp-primary);
}

.sswp-clear {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--sswp-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color .15s;
}

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

/* Spinner */
.sswp-spinner {
  position: absolute;
  right: 44px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--sswp-border);
  border-top-color: var(--sswp-primary);
  border-radius: 50%;
  animation: sswp-spin .7s linear infinite;
  display: none;
}

.sswp-spinner.active {
  display: block;
}

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

/* ─── Dropdown ─── */
.sswp-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--sswp-bg);
  border: 1.5px solid var(--sswp-border);
  border-radius: var(--sswp-radius);
  box-shadow: var(--sswp-shadow);
  overflow: hidden;
  display: none;
  max-height: 520px;
  overflow-y: auto;
  z-index: 99999 !important;
  scrollbar-width: thin;
  scrollbar-color: var(--sswp-border) transparent;
}

.sswp-dropdown.open {
  display: block;
  animation: sswp-drop .18s ease;
}

@keyframes sswp-drop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Section header (per type) ─── */
.sswp-section-header {
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sswp-muted);
  border-bottom: 1px solid var(--sswp-border);
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ─── Result item ─── */
.sswp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--sswp-text);
  border-bottom: 1px solid #f3f4f6;
  transition: background .12s;
  cursor: pointer;
}

.sswp-item:last-child {
  border-bottom: none;
}

.sswp-item:hover,
.sswp-item.focused {
  background: var(--sswp-hover);
}

/* Thumbnail */
.sswp-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f1f5f9;
}

.sswp-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #94a3b8;
}

/* Text */
.sswp-item-body {
  flex: 1;
  min-width: 0;
}

.sswp-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sswp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sswp-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.sswp-item-excerpt {
  font-size: 12px;
  color: var(--sswp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.sswp-cat-tag {
  font-size: 11px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 20px;
  padding: 1px 8px;
  white-space: nowrap;
}

.sswp-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--sswp-accent);
  white-space: nowrap;
}

/* Type badge (small pill on right) */
.sswp-type-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}

.sswp-badge-post {
  background: #dbeafe;
  color: #1d4ed8;
}

.sswp-badge-product {
  background: #fef3c7;
  color: #92400e;
}

.sswp-badge-page {
  background: #dcfce7;
  color: #166534;
}

/* Highlight keyword */
.sswp-hl {
  background: #fef08a;
  border-radius: 2px;
  padding: 0 1px;
}

/* ─── Empty / No results ─── */
.sswp-empty-state {
  padding: 28px 20px;
  text-align: center;
  color: var(--sswp-muted);
}

.sswp-empty-state .sswp-empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.sswp-empty-state p {
  margin: 0;
  font-size: 14px;
}

/* ─── Footer link ─── */
.sswp-footer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sswp-primary);
  text-decoration: none;
  border-top: 1px solid var(--sswp-border);
  background: #f8fafc;
  gap: 6px;
  transition: background .12s;
}

.sswp-footer-link:hover {
  background: var(--sswp-hover);
}

/* Nav icon */
.sswp-nav-trigger button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: inherit;
  display: flex;
  align-items: center;
}

/* ─── Admin Help Styles ─── */
.sswp-desc-sm {
  font-size: 11px;
  color: #64748b;
  margin: -8px 0 12px;
  line-height: 1.4;
}

.sswp-custom-info {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
  font-size: 11px;
  color: #475569;
}

.sswp-custom-info code {
  display: block;
  background: #f8fafc;
  padding: 2px 4px;
  margin: 4px 0;
  border-radius: 4px;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}