/**
 * RAG (Retrieval-Augmented Generation) Styles
 * Visual indicators and styling for AI semantic search results
 */

/* AI Search Badge on Toggle */
.ai-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    margin-left: 0.5rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
    animation: aiPulse 2s ease-in-out infinite;
}

@keyframes aiPulse {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
    }
    50% {
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.5);
    }
}

.dark-mode .ai-badge,
[data-theme="dark"] .ai-badge {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    box-shadow: 0 2px 4px rgba(124, 58, 237, 0.4);
}

/* RAG Search Active Indicator */
.search-bar-wrapper.rag-active {
    position: relative;
}

.search-bar-wrapper.rag-active::before {
    content: '🤖 AI Search';
    position: absolute;
    top: -1.5rem;
    left: 0;
    font-size: 0.75rem;
    color: #8b5cf6;
    font-weight: 600;
    opacity: 0;
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Results Header with RAG Info */
.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 8px;
    border-left: 4px solid #0ea5e9;
}

.dark-mode .search-results-header,
[data-theme="dark"] .search-results-header {
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 100%);
    border-left-color: #38bdf8;
}

.search-results-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #0369a1;
}

.dark-mode .search-results-info,
[data-theme="dark"] .search-results-info {
    color: #7dd3fc;
}

.search-results-info svg {
    width: 18px;
    height: 18px;
}

/* AI Search Mode Toggle Enhancement */
.ai-search-toggle {
    transition: all 0.3s ease;
}

.ai-search-toggle:has(.ai-toggle-input:checked) {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #c084fc;
}

.dark-mode .ai-search-toggle:has(.ai-toggle-input:checked),
[data-theme="dark"] .ai-search-toggle:has(.ai-toggle-input:checked) {
    background: linear-gradient(135deg, #581c87 0%, #6b21a8 100%);
    border-color: #a855f7;
}

/* Loading Animation for RAG Search */
.rag-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
}

.rag-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.rag-loading-text {
    color: #64748b;
    font-size: 0.95rem;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.dark-mode .rag-loading-text,
[data-theme="dark"] .rag-loading-text {
    color: #94a3b8;
}

/* RAG Results Count Badge */
.rag-results-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
}

.rag-results-badge svg {
    width: 14px;
    height: 14px;
}

/* Enhanced Search Input for RAG Mode */
.search-input:focus {
    outline: none;
    /* border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1); */
}

.ai-toggle-input:checked ~ .search-input {
    border-color: #8b5cf6;
}

/* Tooltip for Relevance Badges */
.relevance-badge[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-0.5rem);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-0.25rem);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(-0.5rem);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .search-results-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .ai-search-toggle:has(.ai-toggle-input:checked) {
        padding: 0.5rem 0.75rem;
    }
}
