/* Advanced Search Component Styles */

.search-input {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.suggestions-section {
    border-bottom: 1px solid #f0f0f0;
}

.suggestions-section:last-child {
    border-bottom: none;
}

.suggestions-header {
    padding: 8px 16px;
    background: #f8f9fa;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
}

.clear-history {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: all 0.2s;
}

.clear-history:hover {
    background: #e9ecef;
    color: #333;
}

.suggestions-list {
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    position: relative;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background-color: #f8f9fa;
}

.suggestion-item.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.suggestion-item i {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.suggestion-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-item strong {
    background: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
}

.no-suggestions {
    padding: 16px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Search input enhancements */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-field {
    flex: 1;
    padding: 12px 16px;
    padding-right: 100px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 16px;
    transition: all 0.3s;
    outline: none;
}

.search-input-field:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.search-input-actions {
    position: absolute;
    right: 8px;
    display: flex;
    gap: 5px;
}

.search-action-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.search-action-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.search-action-btn.primary {
    background: #007bff;
    color: white;
}

.search-action-btn.primary:hover {
    background: #0056b3;
}

/* Loading state */
.search-loading {
    padding: 16px;
    text-align: center;
    color: #666;
}

.search-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Search filters quick access */
.search-quick-filters {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.quick-filter-btn {
    padding: 4px 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: #666;
}

.quick-filter-btn:hover {
    background: #e9ecef;
    text-decoration: none;
    color: #333;
}

.quick-filter-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* Voice search button */
.voice-search-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #666;
}

.voice-search-btn.listening {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .search-suggestions {
        max-height: 300px;
        border-radius: 0 0 4px 4px;
    }
    
    .suggestions-list {
        max-height: 150px;
    }
    
    .suggestion-item {
        padding: 10px 12px;
    }
    
    .search-input-field {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 14px;
        padding-right: 80px;
    }
    
    .search-action-btn {
        width: 28px;
        height: 28px;
    }
    
    .search-quick-filters {
        margin-top: 8px;
    }
    
    .quick-filter-btn {
        padding: 3px 6px;
        font-size: 11px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .search-suggestions {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .suggestions-header {
        background: #1a202c;
        color: #a0aec0;
        border-color: #4a5568;
    }
    
    .suggestion-item {
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .suggestion-item:hover,
    .suggestion-item.selected {
        background-color: #4a5568;
    }
    
    .suggestion-item.selected {
        background-color: #2b6cb0;
        border-left-color: #63b3ed;
    }
    
    .search-input-field {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .search-input-field:focus {
        border-color: #63b3ed;
        box-shadow: 0 0 0 3px rgba(99,179,237,0.1);
    }
    
    .search-action-btn {
        color: #a0aec0;
    }
    
    .search-action-btn:hover {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .quick-filter-btn {
        background: #4a5568;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .quick-filter-btn:hover {
        background: #2d3748;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .search-suggestions {
        border-width: 2px;
    }
    
    .suggestion-item.selected {
        border-left-width: 4px;
    }
    
    .search-input-field:focus {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .suggestion-item,
    .search-action-btn,
    .quick-filter-btn,
    .search-input-field {
        transition: none;
    }
    
    .search-loading i {
        animation: none;
    }
    
    .voice-search-btn.listening {
        animation: none;
    }
}