/* Enhanced Search Results Styling */

.search-results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    animation: slideIn 0.3s ease;
    backdrop-filter: blur(4px);
    background: rgba(0, 0, 0, 0.4);
}

.search-results-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 1000px;
    max-height: 85vh;
    background: var(--background-color);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.search-results-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    pointer-events: none;
}

.search-results-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.results-count {
    font-size: 14px;
    opacity: 0.9;
    margin-left: 16px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    position: relative;
    z-index: 1;
}

.close-search {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: all var(--transition-fast);
    position: relative;
    z-index: 1;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-search:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.search-results-content {
    max-height: 65vh;
    overflow-y: auto;
    padding: 0;
    background: var(--background-color);
}

.search-results-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.search-result-card {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 24px 32px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    min-height: 140px;
}

.search-result-card:last-child {
    border-bottom: none;
}

.search-result-card:hover {
    background: var(--hover-color);
    transform: translateX(4px);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
}

.search-result-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform var(--transition-fast);
}

.search-result-card:hover::before {
    transform: scaleY(1);
}

.search-result-image {
    flex-shrink: 0;
    width: 160px;
    height: 100px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.search-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-fast);
}

.search-result-card:hover .search-result-image img {
    transform: scale(1.05);
}

.search-result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.search-result-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
}

.search-result-title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.search-result-title a:hover {
    color: var(--primary-color);
}

.search-result-excerpt {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.search-result-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-color);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.search-result-meta span:hover {
    background: var(--hover-color);
    border-color: var(--primary-color);
}

.search-result-meta i {
    font-size: 12px;
    color: var(--primary-color);
}

/* Fallback image styling */
.search-result-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    border-radius: var(--radius-lg);
}

.fallback-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.fallback-content i {
    font-size: 24px;
    opacity: 0.8;
}

.fallback-content span {
    font-size: 12px;
    line-height: 1.3;
    font-weight: 500;
    opacity: 0.9;
}

/* Enhanced No Results Styles */
.search-no-results {
    text-align: center;
    padding: 60px 32px;
    background: var(--surface-color);
}

.no-results-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    opacity: 0.6;
}

.search-no-results h4 {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

.search-no-results p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.5;
}

.search-suggestions {
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
    background: var(--background-color);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.search-suggestions p {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.search-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-suggestions li {
    padding: 8px 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: 20px;
}

.search-suggestions li::before {
    content: '•';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Enhanced Error Styles */
.search-error {
    text-align: center;
    padding: 60px 32px;
    background: var(--surface-color);
}

.error-icon {
    font-size: 4rem;
    color: #ef4444;
    margin-bottom: 24px;
    opacity: 0.8;
}

.search-error h4 {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

.search-error p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.5;
}

/* Responsive Design for Enhanced Search Results */
@media (max-width: 768px) {
    .search-results-modal {
        width: 98%;
        max-height: 90vh;
        margin: 16px;
    }
    
    .search-results-header {
        padding: 20px 24px;
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .search-results-header h3 {
        font-size: 20px;
    }
    
    .results-count {
        margin-left: 0;
    }
    
    .search-result-card {
        flex-direction: column;
        gap: 16px;
        padding: 20px 24px;
        min-height: auto;
    }
    
    .search-result-image {
        width: 100%;
        height: 200px;
    }
    
    .search-result-title {
        font-size: 18px;
    }
    
    .search-result-excerpt {
        font-size: 14px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    .search-result-meta {
        gap: 12px;
        font-size: 12px;
    }
    
    .search-result-meta span {
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .search-results-modal {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .search-results-header {
        padding: 16px 20px;
    }
    
    .search-result-card {
        padding: 16px 20px;
    }
    
    .search-result-image {
        height: 160px;
    }
}

/* Custom scrollbar for search results */
.search-results-content::-webkit-scrollbar {
    width: 6px;
}

.search-results-content::-webkit-scrollbar-track {
    background: var(--surface-color);
}

.search-results-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.search-results-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Animation for search results */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Loading state for search results */
.search-results-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 32px;
    background: var(--surface-color);
}

.search-results-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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