/**
 * Global Documentation Search Results Styling
 */

#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-width: 500px;
  margin-top: 8px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  max-height: 600px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

[data-theme="dark"] #search-results {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Search Results Header */
.search-results-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 13px;
  color: #64748b;
  position: sticky;
  top: 0;
  z-index: 1;
}

.search-results-header p {
  margin: 0;
  font-weight: 500;
}

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

/* Individual Search Result Item */
.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

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

/* Search Result Title */
.search-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 8px;
  transition: color 0.2s ease;
}

.search-result-title:hover {
  color: #667eea;
  text-decoration: underline;
}

.search-result-title i {
  font-size: 16px;
  color: #64748b;
}

/* Search Result Matches */
.search-result-matches {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Individual Line Match */
.search-result-line {
  padding: 8px;
  background: #f1f5f9;
  border-left: 3px solid #667eea;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}

.search-result-line code {
  display: block;
  word-break: break-word;
  white-space: pre-wrap;
  font-family: 'Monaco', 'Courier New', monospace;
  color: #334155;
}

/* Highlighted search term */
.search-result-line mark {
  background-color: #ffd700;
  color: #334155;
  padding: 2px 4px;
  border-radius: 2px;
  font-weight: 600;
}

[data-theme="dark"] .search-result-line mark {
  background-color: rgba(255, 215, 0, 0.3);
  color: #ffd700;
}

/* Empty State */
.search-results-empty {
  padding: 32px 16px;
  text-align: center;
  color: #64748b;
}

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

.search-results-empty strong {
  color: #334155;
  font-weight: 600;
}

.search-results-tip {
  font-size: 12px;
  margin-top: 12px !important;
}

/* Search Container Position */
.layout-search-container {
  position: relative;
  flex: 1;
  max-width: 400px;
}

/* Search Input Focus State */
.layout-search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Scrollbar Styling for Results */
#search-results::-webkit-scrollbar {
  width: 6px;
}

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

#search-results::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 3px;
}

#search-results::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  #search-results {
    max-width: calc(100vw - 32px);
    max-height: 400px;
  }
  
  .layout-search-container {
    max-width: 100%;
  }
}

@media (max-width: 576px) {
  #search-results {
    max-width: calc(100vw - 16px);
    left: 8px;
    right: 8px;
  }
  
  .search-result-item {
    padding: 10px 12px;
  }
  
  .search-result-title {
    font-size: 13px;
  }
  
  .search-result-line {
    font-size: 11px;
    padding: 6px;
  }
}
