/**
 * TeamWise Documentation Global Search Styles
 */

/* Search Container Positioning */
.home-search {
  position: relative;
}

/* Search Results Container */
.search-results-container {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  max-height: 500px;
  overflow-y: auto;
  z-index: 9999;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dark mode support */
.dark-only .search-results-container {
  background: #1e1e2d;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Results Header */
.search-results-header {
  padding: 12px 20px;
  border-bottom: 1px solid #e5e5e5;
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.dark-only .search-results-header {
  border-bottom-color: #2d2d3d;
  color: #999;
}

/* Results List */
.search-results-list {
  padding: 8px 0;
}

/* Individual Result Item */
.search-result-item {
  display: block;
  padding: 16px 20px;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

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

.search-result-item:hover {
  background-color: #f8f9fa;
}

.dark-only .search-result-item {
  border-bottom-color: #2d2d3d;
}

.dark-only .search-result-item:hover {
  background-color: #2d2d3d;
}

/* Result Header */
.search-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.search-result-page {
  font-size: 12px;
  color: #5579f8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: start;
  width: calc(100% - 82px);
}

.dark-only .search-result-page {
  color: #5579f8;
}

.search-result-relevance {
  font-size: 11px;
  color: #999;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 10px;
}

.dark-only .search-result-relevance {
  background: #2d2d3d;
  color: #888;
}

/* Result Snippet */
.search-result-snippet {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  text-align: left;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dark-only .search-result-snippet {
  color: #999;
}

/* Highlight Matches */
.search-result-item mark {
  background-color: #fff3cd;
  color: #333;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}

.dark-only .search-result-item mark {
  background-color: #5579f8;
  color: #ffffff;
}

/* Loading State */
.search-loading {
  padding: 40px 20px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.dark-only .search-loading {
  color: #999;
}

.search-loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #e5e5e5;
  border-top-color: #5579f8;
  border-radius: 50%;
  margin-left: 10px;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* No Results State */
.search-no-results {
  padding: 50px 20px;
  text-align: center;
  color: #999;
}

.search-no-results i {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.search-no-results p {
  font-size: 14px;
  margin: 0;
}

.dark-only .search-no-results {
  color: #666;
}

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

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

.search-results-container::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 10px;
}

.search-results-container::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}

.dark-only .search-results-container::-webkit-scrollbar-thumb {
  background: #4a4a5a;
}

.dark-only .search-results-container::-webkit-scrollbar-thumb:hover {
  background: #5a5a6a;
}

/* Responsive Design */
@media (max-width: 768px) {
  .search-results-container {
    max-height: 400px;
    left: -20px;
    right: -20px;
    border-radius: 8px;
  }

  .search-result-item {
    padding: 14px 16px;
  }

  .search-result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .search-result-relevance {
    align-self: flex-end;
  }
}

@media (max-width: 480px) {
  .search-results-container {
    position: fixed;
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-height: 60vh;
  }
}
@media (max-width: 448px) {
  .search-results-container {
    bottom: -10px;
  }
}

/* Search Input Focus Enhancement */
.home-search input[type="search"]:focus {
  outline: none;
  border-color: #5579f8;
  box-shadow: 0 0 0 3px rgba(115, 103, 240, 0.1);
}

/* Keyboard Navigation Support */
.search-result-item:focus {
  outline: 2px solid #5579f8;
  outline-offset: -2px;
  background-color: #f8f9fa;
}

.dark-only .search-result-item:focus {
  background-color: #2d2d3d;
}
