/* Enhanced Search Styles */
.enhanced-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: none;
    animation: fadeIn 0.3s ease;
}

.enhanced-search-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5vh;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.enhanced-search-container {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.search-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 20px;
    font-size: 16px;
    background: transparent;
}

.voice-btn,
.search-btn,
.close-search-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    margin: 0 2px;
}

.voice-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.voice-btn.recording {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(245, 87, 108, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 87, 108, 0); }
}

.close-search-btn {
    background: #6c757d;
}

.search-btn:hover,
.voice-btn:hover,
.close-search-btn:hover {
    transform: scale(1.1);
}

.search-hint {
    text-align: center;
    color: white;
    font-size: 12px;
    margin-top: 10px;
    opacity: 0.9;
}

.search-hint kbd {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    font-size: 11px;
}

.search-body {
    max-height: calc(85vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.quick-section {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.quick-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.quick-title {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
}

.clear-btn {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 12px;
}

.clear-btn:hover {
    text-decoration: underline;
}

.quick-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-item {
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-item:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Loading state */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--bs-secondary-color);
    font-size: 0.95rem;
}

.search-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flexbox to respect max-height */
}

.results-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.results-count {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
    font-weight: 500;
}

.results-list {
    flex: 1;
    min-height: 0;
}


.result-section {
	padding: 15px;
    margin-bottom: 2rem;
}

.result-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bs-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bs-primary-bg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-section-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-item {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    background: var(--bs-body-bg);
    transition: all 0.2s ease;
    cursor: pointer;
}

.result-item:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transform: translateY(-1px);
}

.ailment-result {
    border-left: 4px solid var(--bs-success);
}

.remedy-result {
    border-left: 4px solid var(--bs-info);
}

.result-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.result-item.focused {
    background: #e8f4fd;
}

.result-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.result-content {
    flex: 1;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bs-heading-color);
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.result-title mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 0.1em 0.2em;
    border-radius: 0.25rem;
}

.result-category {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    flex-shrink: 0;
}

.ailment-category {
    background-color: var(--bs-success-bg);
    color: var(--bs-success-text);
    border: 1px solid var(--bs-success-border);
}

.remedy-category {
    background-color: var(--bs-info-bg);
    color: var(--bs-info-text);
    border: 1px solid var(--bs-info-border);
}

.category-icon {
    font-size: 1rem;
}

.result-snippet {
    color: var(--bs-secondary-color);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    max-height: 3rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.result-snippet mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 0.1em 0.2em;
    border-radius: 0.25rem;
}

.result-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.result-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

.result-footer .btn {
    margin-left: auto;
    font-size: 0.875rem;
}

/* No results and error states */
.no-results,
.search-error {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.remedies-count,
.ailments-count,
.votes-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.result-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 15px;
}

.related-searches {
    margin-top: 2rem;
    padding: 15px;
    border-top: 1px solid var(--bs-border-color);
}

.related-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-heading-color);
    margin-bottom: 1rem;
}

.related-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.related-search-item {
    background: var(--bs-light);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    padding: 0.5rem 1rem;
    border-radius: 1.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.related-search-item:hover {
    background: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

.related-item {
    padding: 5px 10px;
    background: white;
    border-radius: 15px;
    font-size: 13px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
}

.related-item:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

/* Voice Modal */
.voice-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.voice-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
}

.voice-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 40px;
    animation: pulse 1.5s infinite;
}

.voice-text h3 {
    margin-bottom: 10px;
    color: #333;
}

.voice-text p {
    color: #666;
    margin-bottom: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .result-category {
        align-self: flex-start;
    }
    
    .result-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .result-footer .btn {
        margin-left: 0;
        align-self: flex-end;
    }
    
    .related-items {
        justify-content: center;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .enhanced-search-container {
        background: #1a1a1a;
    }
    
    .search-box {
        background: #2a2a2a;
    }
    
    .search-input {
        color: white;
    }
    
    .quick-item {
        background: #2a2a2a;
        color: #ccc;
        border-color: #3a3a3a;
    }
    
    .result-item {
        border-color: #2a2a2a;
    }
    
    .result-item:hover,
    .result-item.focused {
        background: #2a2a2a;
    }
    
    .result-title {
        color: #fff;
    }
    
    .result-desc {
        color: #aaa;
    }
}