/* Fuzzy Search Styles */
.fuzzy-search-container {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: white;
    border: 2px solid #007bff;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-sizing: border-box;
}

.fuzzy-search-container.show {
    opacity: 1;
    transform: translateY(0);
}

.fuzzy-result-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    position: relative;
}

.fuzzy-result-item:hover {
    background: linear-gradient(135deg, #f8f9ff 0%, #e3f2fd 100%);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.fuzzy-result-item:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
}

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

.fuzzy-result-item .genome-name {
    font-weight: 600;
    color: #007bff;
    margin-bottom: 2px;
    font-size: 13px;
    line-height: 1.3;
}

.fuzzy-result-item .match-info {
    font-size: 11px;
    color: #666;
    line-height: 1.2;
}

.fuzzy-result-item .score-badge {
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.fuzzy-result-item .score-badge.high {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.fuzzy-result-item .score-badge.medium {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: #212529;
    box-shadow: 0 2px 6px rgba(255, 193, 7, 0.3);
}

.fuzzy-result-item .score-badge.low {
    background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
}

.fuzzy-result-item:hover .score-badge {
    transform: scale(1.05);
}

.fuzzy-search-loading {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.fuzzy-search-loading i {
    margin-right: 8px;
    color: #007bff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fuzzy-search-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 14px;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 8px;
}

/* Highlight matched text */
.fuzzy-search-container mark {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    border: 1px solid #ffc107;
}

/* Enhanced search bar styling */
#dtable_filter {
    position: relative;
    margin-bottom: 1rem;
    display: inline-block;
}

#dtable_filter input {
    width: 300px !important;
    height: 40px !important;
    font-size: 16px !important;
    padding: 8px 40px 8px 12px !important;
    border: 2px solid #ddd !important;
    border-radius: 6px !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
    box-sizing: border-box !important;
}

/* Style placeholder text specifically */
#dtable_filter input::placeholder {
    font-size: 12px !important;
    color: #999 !important;
    font-weight: normal !important;
    line-height: 1.2 !important;
}

#dtable_filter input:focus {
    outline: none !important;
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1) !important;
}

/* Add a subtle indicator for fuzzy search */
#dtable_filter::after {
    content: "🔍";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #007bff;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
    line-height: 1;
}

/* Loading state for search input */
#dtable_filter.searching::after {
    content: "⏳";
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

#dtable_filter label {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-bottom: 8px !important;
    display: block !important;
}

/* Custom scrollbar for fuzzy search container */
.fuzzy-search-container::-webkit-scrollbar {
    width: 8px;
}

.fuzzy-search-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.fuzzy-search-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.fuzzy-search-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #dtable_filter input {
        width: 250px !important;
        height: 36px !important;
        font-size: 14px !important;
        padding: 6px 35px 6px 10px !important;
        box-sizing: border-box !important;
    }
    
    #dtable_filter input::placeholder {
        font-size: 11px !important;
    }
    
    #dtable_filter::after {
        font-size: 14px !important;
        right: 10px !important;
    }
    
    .fuzzy-search-container {
        width: 250px;
        max-height: 250px;
    }
    
    .fuzzy-result-item {
        padding: 10px 12px;
    }
    
    .fuzzy-result-item .genome-name {
        font-size: 12px;
    }
    
    .fuzzy-result-item .match-info {
        font-size: 10px;
    }
    
    .fuzzy-result-item .score-badge {
        padding: 3px 6px;
        font-size: 0.7em;
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    #dtable_filter input {
        width: 200px !important;
        height: 32px !important;
        font-size: 13px !important;
        padding: 5px 30px 5px 8px !important;
        box-sizing: border-box !important;
    }
    
    #dtable_filter input::placeholder {
        font-size: 10px !important;
    }
    
    #dtable_filter::after {
        font-size: 12px !important;
        right: 8px !important;
    }
    
    .fuzzy-search-container {
        width: 200px;
        max-height: 200px;
    }
}
