/* ── Site Search Modal ───────────────────────────────────────
 * Loaded on every site with `search_enabled=1`. Self-contained:
 * scoped to `.site-search-*` classes so it doesn't bleed into
 * template-specific styles (default Tailwind, curated inline, etc).
 */
body.site-search-open { overflow: hidden; }

.site-search-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: none;
  align-items: flex-start; justify-content: center;
  padding-top: 10vh;
}
.site-search-modal.open { display: flex; }

.site-search-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  animation: site-search-fadeIn 0.15s;
}

@keyframes site-search-fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.site-search-panel {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  max-height: 75vh;
  background: #fff;
  color: #1a2233;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: site-search-pop 0.18s ease-out;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
}

@keyframes site-search-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.site-search-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.site-search-icon { color: #6b7280; flex: none; }

.site-search-input {
  flex: 1;
  border: none; outline: none;
  font-size: 1.0625rem;
  background: transparent;
  color: inherit;
  font-family: inherit;
  padding: 0;
  margin: 0;
}

.site-search-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.5rem; line-height: 1;
  color: #6b7280;
  padding: 4px 8px;
}
.site-search-close:hover { color: #111827; }

.site-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.site-search-empty {
  padding: 32px 18px;
  color: #6b7280;
  text-align: center;
  font-size: 0.9375rem;
}

.site-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.site-search-item:hover,
.site-search-item.selected {
  background: #f3f4f6;
  border-left-color: #2563eb;
}

.site-search-thumb,
.site-search-thumb-fallback {
  width: 44px; height: 44px;
  border-radius: 8px;
  flex: none;
  object-fit: cover;
  background: #e5e7eb;
}

.site-search-item-body { flex: 1; min-width: 0; }
.site-search-item-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}
.site-search-item-meta {
  font-size: 0.8125rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.site-search-rating {
  color: #f59e0b;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-left: 6px;
}

@media (max-width: 480px) {
  .site-search-modal { padding-top: 0; align-items: stretch; }
  .site-search-panel {
    width: 100%; max-height: 100vh;
    border-radius: 0;
  }
}
