/* Global Search Modal Styles */
.search-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.search-modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.search-modal-container {
  width: 90%;
  max-width: 520px;
  background: rgba(20, 20, 25, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: translateY(-20px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.search-modal-overlay.is-active .search-modal-container {
  transform: translateY(0) scale(1);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 12px;
}

.search-input-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  font-family: var(--font-sans);
  outline: none;
}

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

.search-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  flex-shrink: 0;
}

.search-close-btn:hover {
  color: var(--text);
}

.search-results-wrapper {
  overflow-y: auto;
  padding: 12px;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.search-results-wrapper::-webkit-scrollbar {
  width: 6px;
}
.search-results-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.search-results-wrapper::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.search-empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Mini Card — dark interior + thin neon type border + outer glow (type tag style) */
.search-result-card {
  --search-neon-1: rgb(168, 184, 204);
  --search-neon-2: rgb(168, 184, 204);
  --search-outer-glow: 0 0 12px rgba(168, 184, 204, 0.35);
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background:
    linear-gradient(165deg, #2a2d36 0%, #1e2128 48%, #181a22 100%) padding-box,
    linear-gradient(118deg, var(--search-neon-1), var(--search-neon-2)) border-box;
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: var(--search-outer-glow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-decoration: none;
  color: var(--text);
  transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
}

.search-result-card:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.search-result-card.is-selected {
  filter: brightness(1.1);
  box-shadow: var(--search-outer-glow), 0 0 0 1px rgba(255, 255, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.search-result-img-wrap {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-result-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.search-result-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
  min-width: 0;
}

.search-result-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.search-result-name {
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.search-result-id {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

@media (max-width: 420px) {
  .search-modal-container {
    width: 95%;
    max-height: 85vh;
  }
  .search-results-grid {
    grid-template-columns: 1fr;
  }
}