/* ====== GLOBAL SEARCH ====== */
.global-search {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 100px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.global-search.is-open {
  opacity: 1;
  pointer-events: all;
}

.global-search-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1;
}

.global-search-modal {
  position: relative;
  width: 100%;
  max-width: 700px;
  max-height: 70vh;
  background: rgba(27, 27, 27, 0.98);
  border: 2px solid var(--neon-cyan);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  z-index: 2;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-search.is-open .global-search-modal {
  transform: scale(1);
}

/* Header */
.global-search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.2);
}

.global-search-icon {
  color: var(--neon-cyan);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.global-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-white);
  font-family: 'Oxanium', sans-serif;
  font-size: 1.1rem;
  outline: none;
}

.global-search-input::placeholder {
  color: var(--text-light);
  opacity: 0.5;
}

.global-search-close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.global-search-close:hover {
  color: var(--neon-magenta);
}

/* Filters */
.global-search-filters {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.1);
  overflow-x: auto;
}

.global-search-filter {
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 20px;
  color: var(--text-light);
  font-family: 'Oxanium', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.global-search-filter:hover {
  background: rgba(0, 255, 255, 0.1);
  border-color: var(--neon-cyan);
}

.global-search-filter.is-active {
  background: linear-gradient(90deg, rgba(0, 255, 255, 0.2), rgba(255, 0, 255, 0.2));
  border-color: var(--neon-cyan);
  color: var(--text-white);
}

/* Results */
.global-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 200px;
}

.global-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
  text-align: center;
}

.global-search-empty i {
  font-size: 3rem;
  margin-bottom: 20px;
  color: rgba(0, 255, 255, 0.3);
}

.global-search-empty p {
  font-family: 'Oxanium', sans-serif;
  font-size: 1rem;
}

.global-search-empty strong {
  color: var(--neon-cyan);
}

.global-search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.global-search-result {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.global-search-result:hover,
.global-search-result.is-selected {
  background: rgba(0, 255, 255, 0.1);
  border-color: var(--neon-cyan);
}

.global-search-result-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 8px;
  color: var(--neon-cyan);
  flex-shrink: 0;
}

.global-search-result-content {
  flex: 1;
  min-width: 0;
}

.global-search-result-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-white);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-result-title mark {
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  color: var(--text-on-accent);
  padding: 2px 4px;
  border-radius: 3px;
}

.global-search-result-desc {
  font-family: 'Oxanium', sans-serif;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.global-search-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.global-search-result-tags .tag {
  padding: 2px 8px;
  background: rgba(255, 0, 255, 0.1);
  border: 1px solid rgba(255, 0, 255, 0.3);
  border-radius: 12px;
  color: var(--neon-magenta);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
}

.global-search-result-type {
  padding: 4px 10px;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 12px;
  color: var(--neon-cyan);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
  height: fit-content;
}

/* Footer */
.global-search-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(0, 255, 255, 0.1);
}

.global-search-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  font-family: 'Oxanium', sans-serif;
  font-size: 0.8rem;
  color: var(--text-light);
}

.global-search-hint kbd {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  color: var(--neon-cyan);
}

/* Scrollbar */
.global-search-results::-webkit-scrollbar {
  width: 8px;
}

.global-search-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.global-search-results::-webkit-scrollbar-thumb {
  background: var(--neon-cyan);
  border-radius: 4px;
}

.global-search-results::-webkit-scrollbar-thumb:hover {
  background: var(--neon-magenta);
}

/* Responsive */
@media (max-width: 768px) {
  .global-search {
    padding: 60px 10px;
  }

  .global-search-modal {
    max-height: 80vh;
    width: 100%;
    max-width: 92vw;
    margin: 0 auto;
  }

  .global-search-filters {
    padding: 10px 14px;
  }

  .global-search-header {
    padding: 15px;
  }

  .global-search-input {
    font-size: 1rem;
  }

  .global-search-filters {
    padding: 10px 15px;
  }

  .global-search-filter {
    font-size: 0.75rem;
    padding: 5px 12px;
  }

  .global-search-results {
    padding: 10px;
  }

  .global-search-result {
    padding: 10px;
    gap: 10px;
  }

  .global-search-result-icon {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }

  .global-search-result-title {
    font-size: 0.95rem;
  }

  .global-search-result-desc {
    font-size: 0.8rem;
  }

  .global-search-hint {
    font-size: 0.7rem;
    gap: 8px;
  }

  .global-search-hint kbd {
    padding: 3px 6px;
    font-size: 0.55rem;
  }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  .global-search,
  .global-search-modal {
    transition: none;
  }
}
