/* Global Search & Command Palette Styles */

/* Common overlay styles */
.global-search-overlay,
.command-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-search-overlay.visible,
.command-palette-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Container styles */
.global-search-container,
.command-palette-container {
    width: 100%;
    max-width: 600px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 1rem;
}

.global-search-overlay.visible .global-search-container,
.command-palette-overlay.visible .command-palette-container {
    transform: translateY(0) scale(1);
}

/* Input container styles */
.global-search-input-container,
.command-palette-input-container {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.search-icon,
.command-icon {
    color: #6b7280;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.global-search-input,
.command-palette-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #1f2937;
    background: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.global-search-input::placeholder,
.command-palette-input::placeholder {
    color: #9ca3af;
}

.search-shortcut-hint,
.command-shortcut-hint {
    margin-left: 0.75rem;
    flex-shrink: 0;
}

/* Results container */
.global-search-results,
.command-palette-results {
    max-height: 400px;
    overflow-y: auto;
    background: #ffffff;
}

.search-results-header,
.command-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.8rem;
}

.results-count,
.command-results-count {
    color: #6b7280;
    font-weight: 500;
}

.search-navigation-hints,
.command-navigation-hints {
    display: flex;
    gap: 1rem;
    color: #9ca3af;
    font-size: 0.75rem;
}

/* Results list */
.search-results-list,
.command-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-result-item,
.command-result-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}

.search-result-item:hover,
.command-result-item:hover,
.search-result-item.selected,
.command-result-item.selected {
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
}

.result-icon,
.command-icon-cell {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

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

.result-title,
.command-title {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-subtitle,
.command-id {
    font-size: 0.8rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-type,
.command-category-badge {
    font-size: 0.7rem;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

/* Command category headers */
.command-category-header {
    padding: 0.5rem 1.5rem;
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Footer */
.search-footer,
.command-footer {
    padding: 0.75rem 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.search-tips,
.command-tips {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
}

.search-tips code,
.command-tips code {
    background: #e5e7eb;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

/* Keyboard shortcuts */
kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.7rem;
    color: #4b5563;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Highlight matches */
mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0;
    border-radius: 2px;
}

/* Node highlighting when focused */
.text-node.highlighted,
.recipe-card.highlighted {
    outline: 3px solid #3b82f6;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
}

/* Dark theme support */
.dark-theme .global-search-container,
.dark-theme .command-palette-container {
    background: #1f2937;
    border: 1px solid #374151;
}

.dark-theme .global-search-input-container,
.dark-theme .command-palette-input-container {
    background: #1f2937;
    border-bottom-color: #374151;
}

.dark-theme .global-search-input,
.dark-theme .command-palette-input {
    color: #f9fafb;
}

.dark-theme .global-search-input::placeholder,
.dark-theme .command-palette-input::placeholder {
    color: #6b7280;
}

.dark-theme .search-results-header,
.dark-theme .command-results-header {
    background: #111827;
    border-bottom-color: #374151;
}

.dark-theme .search-result-item,
.dark-theme .command-result-item {
    border-bottom-color: #374151;
}

.dark-theme .search-result-item:hover,
.dark-theme .command-result-item:hover,
.dark-theme .search-result-item.selected,
.dark-theme .command-result-item.selected {
    background: #1e40af;
    border-left-color: #60a5fa;
}

.dark-theme .result-title,
.dark-theme .command-title {
    color: #f9fafb;
}

.dark-theme .result-subtitle,
.dark-theme .command-id {
    color: #9ca3af;
}

.dark-theme .search-footer,
.dark-theme .command-footer {
    background: #111827;
    border-top-color: #374151;
}

/* Responsive design */
@media (max-width: 768px) {
    .global-search-container,
    .command-palette-container {
        margin: 0 0.5rem;
        max-width: calc(100vw - 1rem);
    }
    
    .global-search-input-container,
    .command-palette-input-container {
        padding: 0.75rem 1rem;
    }
    
    .search-result-item,
    .command-result-item {
        padding: 0.5rem 1rem;
    }
    
    .search-navigation-hints,
    .command-navigation-hints {
        display: none;
    }
}

/* Smooth scrolling for results */
.search-results-list,
.command-results-list {
    scroll-behavior: smooth;
}

/* Loading states */
.search-loading,
.command-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
}

.search-loading::before,
.command-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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