/**
 * Global Search Styles
 * Autocomplete search component with categorized results
 */

/* Search Container */
#search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

#search-container.search-active #global-search-input {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Search Input */
#global-search-input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    font-size: 0.875rem;
    color: #1f2937;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    transition: all 0.15s ease;
}

#global-search-input:hover {
    background-color: #f3f4f6;
}

#global-search-input:focus {
    background-color: white;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#global-search-input::placeholder {
    color: #9ca3af;
}

/* Search Icon */
.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 18px !important;
    pointer-events: none;
}

/* Keyboard Shortcut Badge */
.search-shortcut {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #9ca3af;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

#search-container.search-active .search-shortcut {
    display: none;
}

/* Search Results Dropdown */
#search-results {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    z-index: 1000;
}

/* Result Groups */
.search-group {
    border-bottom: 1px solid #f3f4f6;
}

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

.search-group-header {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f9fafb;
    border-bottom: 1px solid #f3f4f6;
}

/* Individual Result Items */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s ease;
    cursor: pointer;
}

.search-result-item:hover,
.search-result-item.selected {
    background: #f3f4f6;
}

.search-result-item.selected {
    background: #eef2ff;
}

.search-result-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 6px;
    color: #6b7280;
    font-size: 16px !important;
}

.search-result-item.selected .search-result-icon {
    background: #e0e7ff;
    color: #4f46e5;
}

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

/* Compact single-line layout */
.search-result-content--compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
}

.search-result-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.search-result-separator {
    color: #d1d5db;
    flex-shrink: 0;
}

.search-result-subtitle {
    font-size: 0.8rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

/* Highlighted match styling */
.search-match {
    font-weight: 600;
    color: #4f46e5;
    background-color: #eef2ff;
    padding: 0 2px;
    border-radius: 2px;
}

.search-result-item.selected .search-match {
    background-color: #c7d2fe;
    color: #3730a3;
}

/* No Results State */
.search-no-results {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    color: #9ca3af;
    font-size: 0.875rem;
}

.search-no-results .material-symbols-outlined {
    font-size: 20px;
}

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

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

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

#search-results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #search-container {
        max-width: 100%;
    }

    .search-shortcut {
        display: none;
    }

    #search-results {
        max-height: 300px;
    }
}
