/* Global Search Overlay Styles */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.search-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.search-container {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    animation: slideDown 0.3s ease;
}

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

/* Search Header */
.search-header {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.search-icon {
    color: var(--primary, #3b82f6);
    font-size: 1.25rem;
}

#global-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.125rem;
    padding: 0.5rem;
}

#global-search-input::placeholder {
    color: var(--text-muted);
}

.search-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 1.25rem;
}

.search-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Search Filters */
.search-filters {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: thin;
}

.search-filters::-webkit-scrollbar {
    height: 4px;
}

.search-filters::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.filter-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn:hover {
    background: var(--border);
    border-color: var(--primary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary, #3b82f6) 0%, #6366f1 100%);
    border-color: var(--primary, #3b82f6);
    color: white;
}

/* Search Results */
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    min-height: 200px;
    max-height: 50vh;
}

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

.search-results::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

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

/* Search States */
.search-hint,
.search-loading,
.search-error,
.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.search-hint i,
.search-loading i,
.search-error i,
.search-no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.search-loading i {
    color: var(--primary);
    opacity: 1;
}

.search-error {
    color: var(--danger);
}

/* Results Groups */
.results-group {
    margin-bottom: 1.5rem;
}

.results-group-title {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-list {
    padding: 0 0.5rem;
}

/* Result Items */
.result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin: 0.25rem 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.result-item:hover,
.result-item.selected {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.result-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary, #3b82f6) 0%, #6366f1 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.125rem;
    flex-shrink: 0;
}

/* Product image thumbnail for inventory items */
.result-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
}

.result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Price badge for item results */
.result-price {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--success, #10b981);
    white-space: nowrap;
    padding-left: 0.25rem;
}

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

.result-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-title mark {
    background: var(--primary);
    color: white;
    padding: 0 0.25rem;
    border-radius: 4px;
}

.result-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta mark {
    background: rgba(59, 130, 246, 0.2);
    color: var(--text-secondary);
    padding: 0 0.25rem;
    border-radius: 4px;
}

/* Search Footer */
.search-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.search-footer kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-overlay {
        padding-top: 5vh;
    }

    .search-container {
        width: 95%;
        max-height: 85vh;
    }

    .search-filters {
        padding: 0.75rem 1rem;
    }

    .filter-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .filter-btn i {
        display: none;
    }

    .search-footer {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .result-item {
        padding: 0.75rem;
    }

    .result-icon,
    .result-thumb {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}
