/* ============================================
   IncideX — Search Overlay
   Self-contained: doesn't depend on style.css or
   bone-page.css. Safe to include on every page type.
   ============================================ */

.search-trigger-btn {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 8px; /* matches the site's other pills (Retour, FR, nav links) — not a circle */
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: rgba(240, 240, 240, 0.8);
  cursor: pointer;
  font: inherit;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.search-trigger-btn:hover,
.search-trigger-btn:focus-visible {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
}
.search-trigger-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
  pointer-events: none;
}

/* Full-width variant for mobile drawer items */
.search-trigger-btn--drawer {
  width: 100%;
  height: auto;
  padding: 12px 16px;
  border-radius: 10px;
  justify-content: flex-start;
  gap: 10px;
  font-size: 0.95rem;
}

/* ---------- Overlay ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  background: rgba(8, 8, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.search-overlay.is-open {
  display: flex;
  opacity: 1;
}

.search-panel {
  width: 100%;
  max-width: 620px;
  max-height: 74vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(24, 24, 28, 0.97), rgba(16, 16, 19, 0.98));
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.08), 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: translateY(-8px);
  transition: transform 0.18s ease;
}
.search-overlay.is-open .search-panel {
  transform: translateY(0);
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.search-input-row svg {
  width: 18px;
  height: 18px;
  stroke: rgba(255, 215, 0, 0.8);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f0f0f0;
  font-size: 1.05rem;
  font-family: inherit;
}
.search-input::placeholder {
  color: rgba(240, 240, 240, 0.4);
}
.search-close-hint {
  font-size: 0.72rem;
  color: rgba(240, 240, 240, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.search-close-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: rgba(240, 240, 240, 0.7);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.search-close-btn:hover,
.search-close-btn:focus-visible {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.5);
}
.search-close-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  pointer-events: none;
}

.search-results {
  overflow-y: auto;
  padding: 8px;
}
.search-results::-webkit-scrollbar { width: 8px; }
.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.search-result-item.is-active,
.search-result-item:hover {
  background: rgba(255, 215, 0, 0.08);
}
.search-result-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}
.search-result-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.search-result-title {
  font-size: 0.95rem;
  color: #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-region {
  font-size: 0.75rem;
  color: rgba(255, 215, 0, 0.75);
}

.search-empty,
.search-loading {
  padding: 40px 20px;
  text-align: center;
  color: rgba(240, 240, 240, 0.45);
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .search-overlay { padding: 0; }
  .search-panel {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .search-close-hint { display: none; }
}
