/* 搜索功能样式 */
.search-container {
    margin: 20px 0;
    position: relative;
    z-index: 100;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    padding: 8px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: #007bff;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.2);
    transform: translateY(-2px);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    padding: 8px 0;
    color: #333;
}

.search-input::placeholder {
    color: #999;
    font-style: italic;
}

.search-button {
    background: none;
    border: none;
    color: #007bff;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
}

.search-button:hover {
    background: rgba(0, 123, 255, 0.1);
    transform: scale(1.1);
}

.clear-search-button {
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
}

.clear-search-button:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #ff4757;
    transform: scale(1.1);
}

/* 搜索结果容器 */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results-header {
    padding: 15px 20px 10px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px 15px 0 0;
}

.search-results-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.search-results-list {
    padding: 10px 0;
}

/* 搜索结果项 */
.search-result-item {
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
}

.search-result-item:hover {
    background: linear-gradient(135deg, #f8f9ff 0%, #e6f3ff 100%);
    border-left-color: #007bff;
    transform: translateX(5px);
}

.search-result-item:focus {
    outline: 2px solid #007bff;
    outline-offset: -2px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e6f3ff 100%);
}

.search-result-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.search-result-category {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-content {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.search-result-meta {
    display: flex;
    align-items: center;
    color: #999;
    font-size: 12px;
    gap: 5px;
}

.search-result-meta i {
    font-size: 10px;
}

/* 关键词高亮 */
.search-highlight {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(255, 193, 7, 0.3);
}

/* 无结果显示 */
.search-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.search-no-results i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

.search-no-results p {
    font-size: 16px;
    margin: 0;
}

/* 搜索建议 */
.search-suggestions {
    padding: 20px;
}

.search-suggestions-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-suggestions-title::before {
    content: "🔥";
    font-size: 18px;
}

.search-suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-suggestion-tag {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #495057;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #dee2e6;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-suggestion-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transition: left 0.5s ease;
}

.search-suggestion-tag:hover {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.search-suggestion-tag:hover::before {
    left: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .search-container {
        margin: 15px 0;
    }
    
    .search-input-wrapper {
        padding: 6px 15px;
    }
    
    .search-input {
        font-size: 14px;
        padding: 6px 0;
    }
    
    .search-results {
        max-height: 400px;
        border-radius: 10px;
    }
    
    .search-results-header {
        padding: 12px 15px 8px;
        border-radius: 10px 10px 0 0;
    }
    
    .search-result-item {
        padding: 12px 15px;
    }
    
    .search-result-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .search-result-category {
        align-self: flex-end;
    }
    
    .search-suggestion-tags {
        gap: 6px;
    }
    
    .search-suggestion-tag {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .search-input::placeholder {
        font-size: 14px;
    }
    
    .search-results {
        max-height: 350px;
        margin-top: 3px;
    }
    
    .search-result-item {
        padding: 10px 12px;
    }
    
    .search-result-title {
        font-size: 15px;
    }
    
    .search-result-content {
        font-size: 13px;
    }
    
    .search-suggestions {
        padding: 15px;
    }
    
    .search-suggestion-tag {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* 滚动条样式 */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
}

/* 加载动画 */
.search-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    color: #007bff;
}

.search-loading i {
    animation: spin 1s linear infinite;
    font-size: 24px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 搜索结果进入动画 */
.search-result-item {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.search-result-item:nth-child(n+1) { animation-delay: calc(0.1s * var(--item-index, 1)); }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .search-input-wrapper {
        border-color: #000;
        background: #fff;
    }
    
    .search-results {
        border-color: #000;
        background: #fff;
    }
    
    .search-highlight {
        background: #ffff00;
        color: #000;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .search-input-wrapper,
    .search-button,
    .clear-search-button,
    .search-result-item,
    .search-suggestion-tag {
        transition: none;
    }
    
    .search-results {
        animation: none;
    }
    
    .search-result-item {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .search-loading i {
        animation: none;
    }
}