/* SOPAN 搜索历史样式 */

.search-history-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

/* 深色模式下的搜索历史下拉菜单 */
.dark .search-history-dropdown {
    background: #1f2937;
    border: 1px solid #374151;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

.search-history-dropdown.show {
    display: block;
}

.search-history-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
}

.search-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

.search-history-item:last-child {
    border-bottom: none;
}

.search-history-item:hover,
.search-history-item.active {
    background-color: #f9fafb;
}

/* 深色模式下的搜索历史项目 */
.dark .search-history-item {
    border-bottom: 1px solid #374151;
}

.dark .search-history-item:hover,
.dark .search-history-item.active {
    background-color: #374151;
}

.history-content {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.history-icon {
    width: 1rem;
    height: 1rem;
    color: #9ca3af;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* 深色模式下的历史图标 */
.dark .history-icon {
    color: #6b7280;
}

.history-text {
    color: #374151;
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 深色模式下的历史文本 */
.dark .history-text {
    color: #f9fafb;
}

.history-text mark {
    background-color: #fef3c7;
    color: #92400e;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

/* 深色模式下的搜索高亮 */
.dark .history-text mark {
    background-color: #1f2937;
    color: #fbbf24;
}

.history-delete {
    width: 1.25rem;
    height: 1.25rem;
    padding: 0.125rem;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.history-delete:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

/* 深色模式下的删除按钮 */
.dark .history-delete {
    color: #9ca3af;
}

.dark .history-delete:hover {
    background-color: #7f1d1d;
    color: #f87171;
}

.history-delete svg {
    width: 100%;
    height: 100%;
}

.search-history-clear {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.25rem;
}

.search-history-clear:hover {
    background-color: #f3f4f6;
}

/* 深色模式下的清除按钮 */
.dark .search-history-clear {
    border-top: 1px solid #374151;
}

.dark .search-history-clear:hover {
    background-color: #374151;
}

.clear-all-content {
    display: flex;
    align-items: center;
    color: #6b7280;
    font-size: 0.875rem;
}

/* 深色模式下的清除内容 */
.dark .clear-all-content {
    color: #9ca3af;
}

.clear-icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    color: #9ca3af;
}

/* 深色模式下的清除图标 */
.dark .clear-icon {
    color: #6b7280;
}

/* 滚动条样式 */
.search-history-dropdown::-webkit-scrollbar {
    width: 4px;
}

.search-history-dropdown::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 2px;
}

.search-history-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.search-history-dropdown::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 深色模式下的滚动条 */
.dark .search-history-dropdown::-webkit-scrollbar-track {
    background: #374151;
}

.dark .search-history-dropdown::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark .search-history-dropdown::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .search-history-dropdown {
        max-height: 250px;
        border-radius: 0.375rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .search-history-item {
        padding: 0.625rem 0.75rem;
    }
    
    .history-text {
        font-size: 0.8125rem;
    }
    
    .clear-all-content {
        font-size: 0.8125rem;
    }
    
    .history-delete {
        width: 1.5rem;
        height: 1.5rem;
        padding: 0.25rem;
    }
}

/* 动画效果 */
.search-history-dropdown {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 确保在搜索框容器中正确定位 */
.search-input-wrapper,
.top-search-input-wrapper {
    position: relative;
}