/* ============================================================
   Meilisearch CODE-WP — Frontend Search
   ============================================================ */

.mscwp-wrap {
  width: 100%;
  font-family: inherit;
}

/* ── Search Form ─────────────────────────────────────────── */
.mscwp-search-form {
  margin-bottom: 28px;
}

.mscwp-keyword-block {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin: -8px 0 28px;
}

.mscwp-keyword-label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  line-height: 34px;
}

.mscwp-keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mscwp-keyword-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s,
    transform 0.15s,
    box-shadow 0.15s;
}

.mscwp-keyword-chip:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

.mscwp-keyword-chip.is-active {
  border-color: #2563eb;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.mscwp-search-box {
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 50px;
  padding: 6px 6px 6px 18px;
  gap: 10px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  max-width: 100%;
}

.mscwp-search-box:focus-within {
  border-color: #3b82f6;
  box-shadow:
    0 0 0 4px rgba(59, 130, 246, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
}

.mscwp-search-icon {
  color: #94a3b8;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.mscwp-search-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 16px !important;
  color: #1e293b !important;
  padding: 8px 0 !important;
  box-shadow: none !important;
  line-height: 1.4;
  min-width: 0;
}

.mscwp-search-input::placeholder {
  color: #94a3b8;
}

.mscwp-search-clear {
  color: #94a3b8;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 50%;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
  flex-shrink: 0;
}

.mscwp-search-clear:hover {
  background: #f1f5f9;
  color: #475569;
}

.mscwp-search-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff !important;
  border: none;
  border-radius: 40px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.2s,
    transform 0.1s,
    box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
  margin: 0px;
}
input.mscwp-search-input {
  margin: 0px;
}

.mscwp-search-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.mscwp-search-btn:active {
  transform: translateY(0);
}

/* ── Empty state ─────────────────────────────────────────── */
.mscwp-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}

.mscwp-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.mscwp-empty-state p {
  font-size: 16px;
  margin: 0;
}

@media (max-width: 640px) {
  .mscwp-keyword-block {
    margin-top: -12px;
  }

  .mscwp-keyword-label {
    width: 100%;
    line-height: 1.4;
  }

  .mscwp-keyword-list {
    gap: 8px;
  }

  .mscwp-keyword-chip {
    min-height: 32px;
    padding: 6px 12px;
    font-size: 13px;
  }
}

/* ── Results header ──────────────────────────────────────── */
.mscwp-results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mscwp-results-count {
  margin: 0;
  font-size: 15px;
  color: #475569;
}

.mscwp-results-count strong {
  color: #1e293b;
}

.mscwp-fallback-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
}

/* ── Product grid ────────────────────────────────────────── */
.mscwp-products {
  width: 100%;
}

.mscwp-product {
  transition: transform 0.2s;
}

/* Box image */
.mscwp-product .box-image {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #f8fafc;
  aspect-ratio: 1 / 1;
}

.mscwp-product .box-image a {
  display: block;
  width: 100%;
  height: 100%;
}

.mscwp-product .box-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.mscwp-product:hover .box-image img {
  transform: scale(1.06);
}

/* No thumbnail placeholder */
.mscwp-no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  min-height: 160px;
}

/* Hover overlay */
.mscwp-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 41, 59, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
  border-radius: 10px;
}

.mscwp-overlay span {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  padding: 6px 16px;
  letter-spacing: 0.3px;
}

.mscwp-product:hover .mscwp-overlay {
  opacity: 1;
}

/* Box text */
.mscwp-product .box-text {
  padding: 12px 4px 8px;
}

.mscwp-product .mscwp-category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  margin: 0 0 5px;
  font-weight: 500;
}

.mscwp-product .product-title {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mscwp-product .product-title a {
  color: #1e293b;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.mscwp-product .product-title a:hover {
  color: #3b82f6;
}

.mscwp-product .mscwp-price .price {
  font-size: 15px;
  font-weight: 700;
  color: #ef4444;
}

/* ── No results ──────────────────────────────────────────── */
.mscwp-no-results {
  text-align: center;
  padding: 60px 20px;
  color: #475569;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px dashed #e2e8f0;
}

.mscwp-no-results-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.mscwp-no-results h3 {
  font-size: 20px;
  margin: 0 0 8px;
  color: #1e293b;
}

.mscwp-no-results p {
  margin: 0 0 16px;
  color: #64748b;
}

.mscwp-suggestions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.mscwp-suggestions li {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 13px;
  color: #64748b;
}

/* ── Pagination ──────────────────────────────────────────── */
.mscwp-pagination {
  margin-top: 36px;
  text-align: center;
}

.mscwp-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  margin: 0 2px;
  transition: all 0.15s;
  background: #fff;
}

.mscwp-pagination .page-numbers:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: #eff6ff;
}

.mscwp-pagination .page-numbers.current {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.mscwp-pagination .page-numbers.prev,
.mscwp-pagination .page-numbers.next {
  width: auto;
  padding: 0 14px;
  font-size: 13px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .mscwp-search-box {
    border-radius: 14px;
    padding: 4px 4px 4px 14px;
  }

  .mscwp-search-btn {
    padding: 10px 16px;
    font-size: 14px;
  }

  .mscwp-search-input {
    font-size: 15px !important;
  }
}

@media (max-width: 480px) {
  .mscwp-search-btn {
    padding: 9px 12px;
    font-size: 13px;
  }
}
