/* AI Search Popup Styles */
.ai-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: all 0.3s ease;
}

.ai-search-overlay.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.ai-search-popup {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #e9ecef 100%);
    border-radius: 20px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    transform: scale(0.8) translateY(50px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.ai-search-overlay.active .ai-search-popup {
    transform: scale(1) translateY(0);
}

.ai-search-header {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
}

.ai-search-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ai-search-header .ai-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
    color: white;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.ai-search-header p {
    opacity: 0.7;
    font-size: 1rem;
    color: #6c757d;
}

.ai-search-form {
    position: relative;
    margin-bottom: 2rem;
}

.ai-search-input {
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: 2px solid #e9ecef;
    border-radius: 50px;
    font-size: 1rem;
    background: #ffffff;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    color: #2c3e50;
}

.ai-search-input:focus {
    background: #ffffff;
    border-color: #6c757d;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.ai-search-input::placeholder {
    color: #666;
    font-style: normal;
}

.ai-search-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.ai-suggestion {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: center;
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
}

.ai-suggestion:hover {
    background: #ffffff;
    border-color: #6c757d;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.ai-suggestion i {
    margin-right: 0.5rem;
    opacity: 0.8;
}

.ai-search-results {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
    display: none;
}

.ai-search-results.active {
    display: block;
}

.ai-result-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    color: #2c3e50;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ai-result-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.ai-result-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 1rem;
    color: #2c3e50;
}

.ai-result-excerpt {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
}

.ai-result-type {
    display: inline-block;
    background: #f1f3f5;
    color: #6c757d;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-search-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.ai-search-close:hover {
    background: #ffffff;
    border-color: #6c757d;
    color: #495057;
    transform: rotate(90deg);
}

.ai-search-loading {
    text-align: center;
    color: #6c757d;
    padding: 2rem;
    display: none;
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
}

.ai-search-loading.active {
    display: block;
}

.ai-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #6c757d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.ai-search-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.ai-search-footer p {
    color: #6c757d;
    font-size: 0.8rem;
    margin: 0;
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-search-popup {
        margin: 1rem;
        padding: 1.5rem;
        border-radius: 15px;
    }
    
    .ai-search-header h2 {
        font-size: 1.5rem;
    }
    
    .ai-search-suggestions {
        grid-template-columns: 1fr;
    }
    
    .ai-suggestion {
        text-align: left;
    }
}

/* Highlight search terms */
.search-highlight {
    background: linear-gradient(120deg, #e9ecef 0%, #dee2e6 100%);
    color: #2c3e50;
    padding: 0.1em 0.2em;
    border-radius: 3px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(108, 117, 125, 0.2);
}

/* Animation for results */
.ai-result-item {
    animation: slideInUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.ai-result-item:nth-child(1) { animation-delay: 0.1s; }
.ai-result-item:nth-child(2) { animation-delay: 0.2s; }
.ai-result-item:nth-child(3) { animation-delay: 0.3s; }
.ai-result-item:nth-child(4) { animation-delay: 0.4s; }
.ai-result-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* AI Search Trigger Button */
.ai-search-trigger {
    position: relative;
    transition: all 0.3s ease !important;
}

.ai-search-trigger:hover {
    color: #667eea !important;
    transform: scale(1.05);
}

.ai-search-trigger::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    animation: aiPulse 2s infinite;
}

@keyframes aiPulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1); 
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.2); 
    }
}

/* Floating AI Search Button */
.ai-search-float { display: none !important; }

.ai-search-float:hover { display: none !important; }

.ai-search-float::before { display: none !important; }

@keyframes floatPulse {
    0%, 100% { 
        transform: translateY(0); 
    }
    50% { 
        transform: translateY(-5px); 
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .ai-search-float { display: none !important; }
}