.search-container {
  position: absolute;
  top: 1.5rem;
  right: 2.5rem;
  width: 320px;
  z-index: 100;
}

.content-sections ~ .search-container,
.content-sections.active ~ .search-container {
  display: none;
}

#hub-cards:not([style*="display: none"]) ~ .search-container {
  display: block;
}

.search-bar {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  color: var(--text-white);
  font-size: 0.9rem;
  font-family: 'Montserrat', sans-serif;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 3px rgba(138, 85, 255, 0.1);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-gray);
  pointer-events: none;
  font-size: 0.9rem;
}

.search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.search-results.active {
  display: block;
}

.search-results::-webkit-scrollbar {
  width: 5px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

.search-result-item {
  padding: 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(138, 85, 255, 0.1);
}

.search-result-title {
  color: var(--text-white);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-result-title i {
  font-size: 0.9rem;
  color: var(--primary-purple);
}

.search-result-description {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  line-height: 1.4;
  margin-left: 1.4rem;
}

.search-highlight {
  color: var(--primary-purple);
  font-weight: 600;
}

.search-no-results {
  padding: 2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 600px) {
  .search-container {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    margin-bottom: 1.5rem;
  }

  .search-results {
    max-height: 300px;
    background: #1f1f1f !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6) !important;
  }

  .search-result-item {
    background-color: transparent;
    padding: 0.9rem;
  }

  .search-result-item:hover {
    background: rgba(138, 85, 255, 0.15) !important;
  }

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

  .search-result-title i {
    font-size: 0.85rem;
  }

  .search-result-description {
    margin-left: 1.2rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .search-container {
    margin-bottom: 1rem;
  }

  .search-input {
    font-size: 0.85rem;
    padding: 0.65rem 2.5rem 0.65rem 0.9rem;
  }

  .search-results {
    max-height: 250px;
  }

  .search-result-item {
    padding: 0.8rem;
  }
}
